<?php

session_start();
ob_start();

//global varable
global $showoutside;

//to check if the page from .htacess
//$showoutside = $_GET['sn'];
// get the config file
include_once("../public/config.php");



//here the db files that include in the file
// GOES HERE ....................
include("../public/include_dao.php");

//Sellbill
require_once('../models/dao/SellbillDAO.class.php');
require_once('../models/dto/Sellbill.class.php');
require_once('../models/mysql/SellbillMySqlDAO.class.php');
require_once('../models/mysql/ext/SellbillMySqlExtDAO.class.php');

//Client
require_once('../models/dao/ClientDAO.class.php');
require_once('../models/dto/Client.class.php');
require_once('../models/mysql/ClientMySqlDAO.class.php');
require_once('../models/mysql/ext/ClientMySqlExtDAO.class.php');




//get the do the action
$do = $_GET['do'];


/* ======================

  Controller Name :- userAjaxCTRL

  OPERTATION in Controller

  1-display add form
  2- add in Save tbl
  3-display sucess or error
  4-display show form
  5-delete from Save tbl
  6-edit in Save data

  ======================== */




//here goes the instances and general variables
//Sellbill
$Sellbill = new Sellbill();
$SellbillDAO = new SellbillMySqlDAO();
$SellbillEX = new SellbillMySqlExtDAO();

//Client
$client = new Client();
$clientDAO = new ClientMySqlDAO();
$clientEX = new ClientMySqlExtDAO();

//KnownWays
$knownWays = new Knownway();
$knownWaysDAO = new KnownwaysMySqlDAO();
$knownWaysExt = new KnownwaysMySqlExtDAO();





if ($do == "showClientsData") {
  $wayid = $_GET['id'];
  $sellBillData = $SellbillEX->queryClientByKnownWay($wayid);
  $clientArr = [];
  foreach ($sellBillData as $bill) {
    $clientArr[] = $clientDAO->load($bill->sellbillclientid);
  }
  $smarty->assign('allClients', $clientArr);
  return $smarty->display('knownwaysreportview/modaldata.html');
}


/* ===============================
  function in this CONTROLLER
  ================================ */
