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

/**
 * Class that operate on table 'restaurantorderdetails'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2018-05-16 11:38
 */
class RestaurantorderdetailsMySqlExtDAO extends RestaurantorderdetailsMySqlDAO {

    public function getlastrestaurantorderdetails($orderId) {
       $sql = 'SELECT * FROM `restaurantorderdetails` 
               left join product on restaurantorderdetails.productId = product.productId
               left join productcat on product.productCatId = productcat.productCatId
                WHERE orderId = '.$orderId;
       $sqlQuery = new SqlQuery($sql);
       return $this->getList($sqlQuery);
    }

    public function queryByOrderIdAndProduct($orderid, $productId) {
        $sql = 'SELECT * FROM restaurantorderdetails WHERE productId = ' . $productId . ' and orderId = ' . $orderid;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function deleteByOrderIdAndProduct($orderid, $productId) {
        $sql = 'DELETE FROM restaurantorderdetails WHERE productId = ' . $productId . ' and orderId = ' . $orderid;
        $sqlQuery = new SqlQuery($sql);
        return $this->executeUpdate($sqlQuery);
    }

     public function changeorderid($orderId, $id) {
        $sql = 'UPDATE restaurantorderdetails SET orderId = "' . $orderId . '" WHERE id = ' . $id;
        $sqlQuery = new SqlQuery($sql);

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

    public function queryByOrderIdEX($value) {
        $sql = 'SELECT restaurantorderdetails.*,product.productName
                FROM restaurantorderdetails
                join product on product.productId = restaurantorderdetails.productId
                WHERE orderId = ?';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setNumber($value);
        return $this->getList($sqlQuery);
    }

    public function queryByOrderIdAndProductEX($orderId, $productId) {
        $sql = 'SELECT *
                FROM restaurantorderdetails
                WHERE orderId = ' . $orderId . ' and productId = ' . $productId . '';
        $sqlQuery = new SqlQuery($sql);
        return $this->getRow($sqlQuery);
    }

    public function queryByOrderIdNotPrinted($value) {
        $sql = 'SELECT restaurantorderdetails.*
                FROM restaurantorderdetails
                WHERE orderId = ? and isPrinted = 0';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setNumber($value);
        return $this->getList($sqlQuery);
    }

    public function queryByOrderId($orderid) {
        $sql = 'SELECT * FROM restaurantorderdetails WHERE orderId = ' . $orderid;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function getOrderDetailsTotal($orderid) {
        $sql = 'SELECT sum(total)
                FROM restaurantorderdetails
                WHERE orderId = ' . $orderid;
        $sqlQuery = new SqlQuery($sql);
        return $this->querySingleResult($sqlQuery);
    }

}

?>