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/models/mysql/ext/KempialaMySqlExtDAO.class.php
<?php

/**
 * Class that operate on table 'kempiala'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2013-04-06 10:57
 */
class KempialaMySqlExtDAO extends KempialaMySqlDAO {

    ///===================== available kemp===========================////////
    public function queryAlllimted($start, $end, $supplierID, $today) {
        $sql = 'SELECT kempiala.*  ,client.clientname  FROM kempiala
		join client on client.clientid=kempiala.clientID
		where supplierID= ' . $supplierID . ' and expiredate >= "' . $today . '"
		order by id desc limit ' . $start . ',' . $end . '';



        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllex($supplierID, $today) {
        $sql = 'SELECT * FROM kempiala where supplierID= ' . $supplierID . '  and expiredate >= "' . $today . '" ';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    ///===================== sold kemp===========================////////
    public function queryAllsoldlimted($start, $end, $supplierID) {
        $sql = 'SELECT kempiala.*  ,client.clientname  FROM kempiala
		join client on client.clientid=kempiala.clientID
		where supplierID != ' . $supplierID . '
		order by id desc limit ' . $start . ',' . $end . '';



        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllsold($supplierID) {
        $sql = 'SELECT * FROM kempiala where supplierID != ' . $supplierID . '   ';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

///===================== expier kemp===========================////////
    public function queryAllexpier($supplierID, $today) {
        $sql = 'SELECT kempiala.*  ,client.clientname  FROM kempiala
		join client on client.clientid=kempiala.clientID
		where supplierID = ' . $supplierID . ' and expiredate < "' . $today . '"
		order by id desc';

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllexpierlimted($start, $end, $supplierID, $today) {
        $sql = 'SELECT kempiala.*  ,client.clientname  FROM kempiala
		join client on client.clientid=kempiala.clientID
		where supplierID= ' . $supplierID . ' and expiredate < "' . $today . '"
		order by id desc  limit ' . $start . ',' . $end . '';



        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    ///===================== end   expier kemp===========================////////
    // load all kemp data
    public function loadEX($id) {
        $sql = 'SELECT kempiala.*  ,client.clientname,supplier.suppliername  FROM kempiala
		join client on client.clientid=kempiala.clientID
		 left join supplier on
		supplier.supplierid=kempiala.supplierID
		where kempiala.id=' . $id . '
		 ';



        $sqlQuery = new SqlQuery($sql);
        return $this->getRow($sqlQuery);
    }

    public function updatekemp($kempiala, $clientcomment) {
        $sql = 'UPDATE kempiala SET  clientcomment = ?,  expiredate = ? WHERE id = ?';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setString2($clientcomment);
        $sqlQuery->set($kempiala->expiredate);


        $sqlQuery->setNumber($kempiala->id);
        return $this->executeUpdate($sqlQuery);
    }

    public function updatedel($kempiala) {

        $sql = 'UPDATE kempiala SET conditions = ?  WHERE id = ?';
        $sqlQuery = new SqlQuery($sql);

        $sqlQuery->setNumber($kempiala->conditions);


        $sqlQuery->setNumber($kempiala->id);
        return $this->executeUpdate($sqlQuery);
    }

    public function updatesell($kempiala, $suppliercomment) {
        $sql = 'UPDATE kempiala SET selling = ?,  supplierID = ?, sellingdate = ? , suppliercomment = ? WHERE id = ?';
        $sqlQuery = new SqlQuery($sql);

        $sqlQuery->setNumber($kempiala->selling);

        $sqlQuery->setNumber($kempiala->supplierID);
        $sqlQuery->set($kempiala->sellingdate);

        $sqlQuery->setString2($suppliercomment);

        $sqlQuery->setNumber($kempiala->id);
        return $this->executeUpdate($sqlQuery);
    }

    public function queryWithSellingAndConditions($selling) {
        $sql = 'SELECT * FROM kempiala where selling = ' . $selling . ' and conditions = 0';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryWithSellingAndConditionsExt($selling) {
        $sql = 'SELECT SUM(value) FROM kempiala
		where selling = ' . $selling . '
		and conditions = 0';
        $sqlQuery = new SqlQuery($sql);
        return $this->QuerySingleResult($sqlQuery);
    }

    public function queryAllkempila($today, $todayfor7days) {
        $sql = 'SELECT client.*,kempiala.* FROM kempiala JOIN client
		ON client.clientid=kempiala.clientID
		 where kempiala.conditions=0 and kempiala.selling=0
		  and kempiala.expiredate >=  "' . $today . '"  and  kempiala.expiredate <= "' . $todayfor7days . '" ';
        //print_r("<br>".$sql);
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAlllavilablekempila($supplierID, $today) {
        $sql = 'SELECT kempiala.* FROM kempiala
		where supplierID= ' . $supplierID . '
		and conditions =0 and expiredate >= "' . $today . '"';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAlllavilablekempila2($supplierID, $today) {
        $sql = 'SELECT kempiala.* FROM kempiala
		where supplierID= ' . $supplierID . '
		and conditions =0 and expiredate > "' . $today . '"';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllexpierkempila($supplierID, $today) {
        $sql = 'SELECT kempiala.*   FROM kempiala
		where supplierID = ' . $supplierID . '
			and conditions =0 and expiredate < "' . $today . '"
		order by id desc';

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllexpierkempila2($supplierID, $today) {
        $sql = 'SELECT kempiala.*   FROM kempiala
		where supplierID = ' . $supplierID . '
			and conditions =0 and expiredate < "' . $today . '"
		order by id desc';

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>