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/rentproduct_out.php
<?php

//the global file operation
include("../public/impOpreation.php");

//global varable
global $showoutside;

//to check if the page from .htacess
//$showoutside = $_GET['sn'];
// get the config file

require_once('../models/dao/YoutubeLinkDAO.class.php');
require_once('../models/dto/YoutubeLink.class.php');
require_once('../models/mysql/YoutubeLinkMySqlDAO.class.php');
require_once('../models/mysql/ext/YoutubeLinkMySqlExtDAO.class.php');


include_once("../public/config.php");
include_once("dailyentryfun.php");

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


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

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

  Controller Name :- productController

  OPERTATION in Controller

  1- display add form, add supplier cat and supplier with ajax
  2- add in supplier tbl
  2.1- insert into supplier unit tbl
  2.2- insert into storedetail tbl
  2.3- insert new row into storereport tbl
  3- display show and tempdelete
  4- edit supplier
  5- update supplier
  5.1- update supplier tbl with supplierid
  5.2- delete supplier units associated to this supplier from productunit tbl, then insert it again

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

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

//here goes the instances and general variables
//Accountstree
$accountsTree = new Accountstree();
$accountsTreeDAO = new AccountstreeMySqlDAO();
$accountsTreeEX = new AccountstreeMySqlExtDAO();

//Supplierdebtchange
$Supplierdebtchange = new Supplierdebtchange();
$SupplierdebtchangeDAO = new SupplierdebtchangeMySqlDAO();
$SupplierdebtchangeEX = new SupplierdebtchangeMySqlExtDAO();

//Programsetting
$Programsetting = new Programsetting();
$ProgramsettingDAO = new ProgramsettingsMySqlDAO();
$ProgramsettingEX = new ProgramsettingsMySqlExtDAO();


//Dailyentry
$dailyEntry = new Dailyentry();
$dailyEntryDAO = new DailyentryMySqlDAO();
$dailyEntryEX = new DailyentryMySqlExtDAO();

//Dailyentrycreditor دائن
$dailyEntryCreditor = new Dailyentrycreditor();
$dailyEntryCreditorDAO = new DailyentrycreditorMySqlDAO();
$dailyEntryCreditorEX = new DailyentrycreditorMySqlExtDAO();

//Dailyentrydebtor مدين
$dailyEntryDebtor = new Dailyentrydebtor();
$dailyEntryDebtorDAO = new DailyentrydebtorMySqlDAO();
$dailyEntryDebtorEX = new DailyentrydebtorMySqlExtDAO();

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

$Programsettingdata = $ProgramsettingDAO->load(1);
$smarty->assign("Programsettingdata", $Programsettingdata);


$youtubeLink = new YoutubeLink();
$youtubeLinkDAO = new YoutubeLinkMySqlDAO();
$youtubeLinkEX = new YoutubeLinkMySqlExtDAO();

/* * * classes ** */
$rentProducts = new Rentproduct();
$myrentProducts = new RentproductMySqlDAO();
$extrentProducts = new RentproductMySqlExtDAO();

$rentStore = new Rentstore();
$myrentStore = new RentstoreMySqlDAO();
$extrentStore = new RentstoreMySqlExtDAO();

$supplier = new Supplier();
$mysupplier = new SupplierMySqlDAO();
$extsupplier = new SupplierMySqlExtDAO();

$save = new Save();
$mysave = new SaveMySqlDAO();
$extsave = new SaveMySqlExtDAO();

$Savedaily = new Savedaily();
$SavedailyDAO = new SavedailyMySqlDAO();

$client = new Client();
$myclient = new ClientMySqlDAO();
$extclient = new ClientMySqlExtDAO();

$rentbill = new Rentbill();
$myrentbill = new RentbillMySqlDAO();
$extrentbill = new RentbillMySqlExtDAO();

$rentbillpro = new Rentbillprop();
$myrentbillpro = new RentbillpropMySqlDAO();
$extrentbillpro = new RentbillpropMySqlExtDAO();


//check and use the condition that suite this action
if (empty($do)) {
    //here the permssion check
    include_once("../public/authentication.php");

    $suppliers = $mysupplier->queryAll();
    $smarty->assign('suppliers', $suppliers);

    $supplierid = filter_input(INPUT_POST, 'supplierid');
    $startdate = filter_input(INPUT_POST, 'startdate');
    $enddate = filter_input(INPUT_POST, 'enddate');
    if (!$startdate && !$enddate) {
        $showsearch = 0;
    } else {
        $showsearch = 1;


        $smarty->assign('startdate', $startdate);
        $smarty->assign('enddate', $enddate);

        if ($supplierid == 0) {
            //all products
            $smarty->assign('suppliername', 'كل الموردين');

            $allpros = $extrentbillpro->rentoutstill($startdate, $enddate);
            foreach ($allpros as $spro) {
                $supplierinfo = $mysupplier->load($spro->supplierid);
                $spro->suppliername = $supplierinfo->suppliername;

                $productinfo = $myrentProducts->load($spro->productid);
                $spro->productname = $productinfo->name;

                $billinfo = $myrentbill->load($spro->billid);
                $clientinfo = $myclient->load($billinfo->clientid);
                $spro->clientname = $clientinfo->clientname;
            }

            $smarty->assign('allpros', $allpros);
        } else {

            $allpros = $extrentbillpro->rentoutstillwithsupplier($startdate, $enddate, $supplierid);
            foreach ($allpros as $spro) {
                $supplierinfo = $mysupplier->load($spro->supplierid);
                $spro->suppliername = $supplierinfo->suppliername;

                $productinfo = $myrentProducts->load($spro->productid);
                $spro->productname = $productinfo->name;

                $billinfo = $myrentbill->load($spro->billid);
                $clientinfo = $myclient->load($billinfo->clientid);
                $spro->clientname = $clientinfo->clientname;
            }

            $smarty->assign('suppliername', $allpros[0]->suppliername);
            $smarty->assign('allpros', $allpros);
        }
    }
    $smarty->assign('showsearch', $showsearch);

    $youtubes = $youtubeLinkDAO->queryAll();
    $smarty->assign("youtubes", $youtubes);
    //here the smarty templates
    $smarty->display("rent/reports/rentproduct_out.html");
}
//here the global templates
$smarty->assign("rentjs", 1);
$smarty->display("footer.html");

/* ===============================
  function in this CONTROLLER
  ================================ */
?>