File: /home/mostafedeg/public_html/erp/controllers/profitproductAjaxController.php
<?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");
//Product
require_once('../models/dao/ProductDAO.class.php');
require_once('../models/dto/Product.class.php');
require_once('../models/mysql/ProductMySqlDAO.class.php');
require_once('../models/mysql/ext/ProductMySqlExtDAO.class.php');
//get the do the action
$do = $_GET['do'];
/* ======================
Controller Name :- profitreportCTRL تقرير يومية الخزينة
OPERTATION in Controller
1-load save data
2-display show form
3-display details form for save
4-display details for operation in savedaily
======================== */
//here goes the instances and general variables
//Product
$myProductRecord = new ProductMySqlDAO();
$myProductEx = new ProductMySqlExtDAO();
//check and use the condetion that suite this action
if ($do == "loadproduct") {
$productcatId = $_GET['catid'];
$productData = loadProductByCatId($productcatId);
$smarty->assign("productData", $productData);
$smarty->display("profitproductview/product.html");
}
/* ===============================
function in this CONTROLLER
================================ */
function loadProductByCatId($productCatId) {
global $myProductEx;
$productData = $myProductEx->queryWithProductcatIdAndConditions($productCatId);
return $productData;
}
?>