HEX
Server: Apache
System: Linux server1.royalgt4.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
User: mostafedeg (1125)
PHP: 5.6.40
Disabled: mail,passthru,parse_ini_file,show_source,eval,assert,pcntl_exec,dl,putenv,proc_open,popen
Upload Files
File: /home/mostafedeg/public_html/erp/controllers/clientReportsControllerAjax.php
<?php

//the global file operation
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
include("../public/include_dao.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');
//Clientdebtchange
require_once('../models/dao/ClientdebtchangeDAO.class.php');
require_once('../models/dto/Clientdebtchange.class.php');
require_once('../models/mysql/ClientdebtchangeMySqlDAO.class.php');
require_once('../models/mysql/ext/ClientdebtchangeMySqlExtDAO.class.php');

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

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

  Controller Name :- clientReportsController

  OPERTATION in Controller

  1- تقرير تحصيل
  ======================== */

//here the global templates
$smarty->display("header.html");

//here goes the instances and general variables
//Client
$client = new Client();
$clientDAO = new ClientMySqlDAO();
$clientExt = new ClientMySqlExtDAO();
//Clientdebtchange
$clientDeptChange = new Clientdebtchange();
$clientDeptChangeDAO = new ClientdebtchangeMySqlDAO();
$clientDeptChangeExt = new ClientdebtchangeMySqlExtDAO();

$today = date("Y-m-d");

//check and use the condition that suite this action
if (empty($do) || $do == "show") {// تقرير تحصيل
    //here the permssion check
    $startDate = $_REQUEST['from'];
    $endDate = $_REQUEST['to'];
    if (isset($startDate) && isset($endDate) && $startDate != "" && $endDate != "") {
        $message = "التاريخ: من: " . $startDate . " إلى: " . $endDate;
        $smarty->assign("message", $message);

        show($startDate, $endDate);
    }
    $smarty->display("clientReportsview/show.html");
}
//here the global templates
$smarty->display("footer.html");

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

//show
function show($startDate, $endDate) {
    global $clientDeptChangeExt;
    global $smarty;

    // required connect
    $paginate = new SmartyPaginate;
    $paginate->connect();
    // set items per page
    $paginate->setLimit(25);
    // get the all colums number
    $allColums = $clientDeptChangeExt->queryPayedDeptOnly($startDate, $endDate);
    $paginate->setTotal(count($allColums));
    //get the selected data with limitation
    $shownData = $clientDeptChangeExt->queryPayedDeptOnlyLimited($startDate, $endDate, $paginate->getCurrentIndex(), $paginate->getLimit());

    $sum;
    foreach ($shownData as $data) {
        $sum += $data->clientdebtchangeamount;
    }
    $smarty->assign('sum', $sum);

    // assign db results to the template
    $smarty->assign('shownData', $shownData);
    // assign {$paginate} var
    $paginate->assign($smarty);
    //text that show in navgation
    $paginate->setNextText('التالى');
    $paginate->setPrevText('السابق');
    //add any varaible in url
    $paginate->setUrl('clientReportsController.php?do=show&from=' . $startDate . '&to=' . $endDate);
}

?>