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/MComreceiptMySqlExtDAO.class.php
<?php
/**
 * Class that operate on table 'm_comreceipt'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2014-09-07 16:06
 */
class MComreceiptMySqlExtDAO extends MComreceiptMySqlDAO{

	public function loadcase($id){
		$sql = "SELECT * FROM m_comreceipt
				WHERE receiptserial LIKE '".$id."%' order by receiptserial desc";

		$sqlQuery = new SqlQuery($sql);
		
		return $this->getRow($sqlQuery);
	}
	
	
	public function getClientIdUsingOurSerial($value){
		$sql = 'SELECT m_comreceipt.id,clientid ,m_comreceiptdetail.currentstage
				FROM m_comreceipt
				JOIN  m_comreceiptdetail  ON   m_comreceiptdetail.receiptid = m_comreceipt.id
				WHERE m_comreceiptdetail.ourSerial = ?';
		$sqlQuery = new SqlQuery($sql);
		$sqlQuery->set($value);
		
		//print_r($sqlQuery);
		return $this->getRow($sqlQuery);
	}	
	
	
	public function queryAllforreceiptshow($querystring){
		$sql = 'SELECT DISTINCT(m_comreceipt.id) as id , m_comreceipt.receiptdat,m_comreceipt.Initialcost,m_comreceipt.receiptserial
				,client.clientname,m_comreceipt.status
				 FROM m_comreceipt
				 JOIN  m_comreceiptdetail  ON   m_comreceiptdetail.receiptid = m_comreceipt.id
				join client
				on client.clientid=m_comreceipt.clientid
				'.$querystring.'
				and m_comreceipt.del=0
				and m_comreceipt.status=0
				
				order by m_comreceipt.id DESC
				 ';
				
				//print_r("<br>".$sql);
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	public function getserialnumber(){
		$sql = 'SELECT DISTINCT(m_comreceipt.receiptserial) AS receiptserial FROM m_comreceipt
		WHERE del=0';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	public function getserialnumber2($name){
		$sql = 'SELECT DISTINCT m_comreceipt.receiptserial AS value , m_comreceipt.receiptserial AS label 
		FROM m_comreceipt
		WHERE m_comreceipt.receiptserial LIKE "%'.$name.'%" 
		AND del=0 And status = 0';
		$sqlQuery = new SqlQuery($sql);
		return $this->getList($sqlQuery);
	}
	
	 public function loadEX($id){
		$sql = 'SELECT m_comreceipt.* ,client.clientname   FROM m_comreceipt  
		join client
		on client.clientid=m_comreceipt.clientid  WHERE m_comreceipt.id = ?';
		$sqlQuery = new SqlQuery($sql);
		$sqlQuery->setNumber($id);
		return $this->getRow($sqlQuery);
	}
	
	public function updateMComReceiptStatus($status,$id){
		$sql = 'UPDATE m_comreceipt SET  status = ? WHERE id = ?';
		$sqlQuery = new SqlQuery($sql);

		$sqlQuery->setNumber($status);
		$sqlQuery->setNumber($id);
		return $this->executeUpdate($sqlQuery);
	}
	
	
	public function markAsDone($id){
		$sql = 'UPDATE m_comreceipt SET  status = 1 WHERE id = ?';
		$sqlQuery = new SqlQuery($sql);

		$sqlQuery->setNumber($id);
		return $this->executeUpdate($sqlQuery);
	}
	
	
	public function updatedel($mComreceipt){
		$sql = 'UPDATE m_comreceipt SET  receiptdat = ?, branchid = ?,userid = ?, del = ? WHERE id = ?';
		$sqlQuery = new SqlQuery($sql);
		
		$sqlQuery->set($mComreceipt->receiptdat);
		$sqlQuery->setNumber($mComreceipt->branchid);
		$sqlQuery->setNumber($mComreceipt->userid);
		$sqlQuery->setNumber($mComreceipt->del);

		$sqlQuery->setNumber($mComreceipt->id);
		return $this->executeUpdate($sqlQuery);
	}
	
	public function getTotalCostComRecIDTotalCost($comRecID){
		$sql = 'select totalCost from m_comreceipt WHERE id = ?';
		$sqlQuery = new SqlQuery($sql);

		$sqlQuery->setNumber($comRecID);
		return $this->querySingleResult($sqlQuery);
	}

	public function increaseComRecIDTotalCost($comRecID,$totalCost){
		$sql = 'UPDATE m_comreceipt SET totalCost = ? WHERE id = ?';
		$sqlQuery = new SqlQuery($sql);
		
		$sqlQuery->setNumber($totalCost);

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


	public function loadid(){
		$sql = ' SELECT `id`
					FROM m_comreceipt
					ORDER BY `id` DESC
					LIMIT 0 , 1 ';
		$sqlQuery = new SqlQuery($sql);
		return $this->getRow($sqlQuery);
	}	
	
	public function getRecitIdUsingItsSerial($value){
		$sql = 'SELECT id FROM m_comreceipt WHERE receiptserial = ?';
		$sqlQuery = new SqlQuery($sql);
		$sqlQuery->set($value);
		return $this->querySingleResult($sqlQuery);
	}
	
	
	public function queryAllMComreceipt(){
		$sql = 'SELECT * FROM m_comreceipt
		order by id DESC
		LIMIT 0 , 1';
		$sqlQuery = new SqlQuery($sql);
		return $this->getRow($sqlQuery);
	}
	
	public function queryByClientidforrecipt($value){
		$sql = 'SELECT * FROM m_comreceipt WHERE clientid = ?
		and del =0';
		$sqlQuery = new SqlQuery($sql);
		$sqlQuery->setNumber($value);
		return $this->getList($sqlQuery);
	}
}
?>