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

/**
 * Class that operate on table 'quickprofitclient'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2019-01-21 13:45
 */
class QuickprofitclientMySqlExtDAO extends QuickprofitclientMySqlDAO {

    public function insertOrUpdatePlusEX($obj) {
        //must have UNIQUE constraint on the "combination" of the two columns
        //ALTER TABLE quickprofitclient ADD CONSTRAINT uq_quickprofitclient UNIQUE(`clientId`, `theDate`)
        $sql = " INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ($obj->clientId, '" . $obj->theDate . "', $obj->sellVal, $obj->sellCostBuyPrice, $obj->sellCostLastBuyPrice
                    , $obj->sellCostMeanBuyPrice, $obj->sellCostLastBuyPricewithDiscount, $obj->sellCostMeanBuyPricewithDiscount, $obj->sellCostOverAllAveragePrice
                    , $obj->returnSellVal, $obj->returnSellCostBuyPrice, $obj->returnSellCostLastBuyPrice, $obj->returnSellCostMeanBuyPrice
                    , $obj->returnSellCostLastBuyPricewithDiscount, $obj->returnSellCostMeanBuyPricewithDiscount, $obj->returnSellCostOverAllAveragePrice ,$obj->sellCostLastBuyPricewithTax, $obj->sellCostMeanBuyPricewithTax, $obj->returnSellCostLastBuyPricewithTax, $obj->returnSellCostMeanBuyPricewithTax)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+$obj->sellVal, sellCostBuyPrice =sellCostBuyPrice+$obj->sellCostBuyPrice
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+$obj->sellCostLastBuyPrice, sellCostMeanBuyPrice = sellCostMeanBuyPrice+$obj->sellCostMeanBuyPrice
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+$obj->sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+$obj->sellCostMeanBuyPricewithDiscount
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+$obj->sellCostOverAllAveragePrice
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+$obj->sellCostLastBuyPricewithTax
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+$obj->sellCostMeanBuyPricewithTax
                        , returnSellVal = returnSellVal+$obj->returnSellVal, returnSellCostBuyPrice = returnSellCostBuyPrice+$obj->returnSellCostBuyPrice, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+$obj->returnSellCostLastBuyPrice
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+$obj->returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+$obj->returnSellCostLastBuyPricewithDiscount
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+$obj->returnSellCostMeanBuyPricewithDiscount
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+$obj->returnSellCostOverAllAveragePrice
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+$obj->returnSellCostLastBuyPricewithTax
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+$obj->returnSellCostMeanBuyPricewithTax";
        $sqlQuery = new SqlQuery($sql);
        return $this->executeUpdate($sqlQuery);
    }

    public function insertOrUpdateMinusEX($obj) {
        //must have UNIQUE constraint on the "combination" of the two columns
        //ALTER TABLE quickprofitclient ADD CONSTRAINT uq_quickprofitclient UNIQUE(`clientId`, `theDate`)
        $sql = " INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ($obj->clientId, '" . $obj->theDate . "', $obj->sellVal, $obj->sellCostBuyPrice, $obj->sellCostLastBuyPrice
                    , $obj->sellCostMeanBuyPrice, $obj->sellCostLastBuyPricewithDiscount, $obj->sellCostMeanBuyPricewithDiscount, $obj->sellCostOverAllAveragePrice
                    , $obj->returnSellVal, $obj->returnSellCostBuyPrice, $obj->returnSellCostLastBuyPrice, $obj->returnSellCostMeanBuyPrice
                    , $obj->returnSellCostLastBuyPricewithDiscount, $obj->returnSellCostMeanBuyPricewithDiscount, $obj->returnSellCostOverAllAveragePrice, $obj->sellCostLastBuyPricewithTax, $obj->sellCostMeanBuyPricewithTax, $obj->returnSellCostLastBuyPricewithTax, $obj->returnSellCostMeanBuyPricewithTax)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-$obj->sellVal, sellCostBuyPrice =sellCostBuyPrice-$obj->sellCostBuyPrice
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-$obj->sellCostLastBuyPrice, sellCostMeanBuyPrice = sellCostMeanBuyPrice-$obj->sellCostMeanBuyPrice
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-$obj->sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-$obj->sellCostMeanBuyPricewithDiscount
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-$obj->sellCostOverAllAveragePrice
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-$obj->sellCostLastBuyPricewithTax
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-$obj->sellCostMeanBuyPricewithTax
                        , returnSellVal = returnSellVal-$obj->returnSellVal, returnSellCostBuyPrice = returnSellCostBuyPrice-$obj->returnSellCostBuyPrice, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-$obj->returnSellCostLastBuyPrice
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-$obj->returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-$obj->returnSellCostLastBuyPricewithDiscount
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-$obj->returnSellCostMeanBuyPricewithDiscount
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-$obj->returnSellCostOverAllAveragePrice
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-$obj->returnSellCostLastBuyPricewithTax
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-$obj->returnSellCostMeanBuyPricewithTax";
        $sqlQuery = new SqlQuery($sql);
        return $this->executeUpdate($sqlQuery);
    }

    public function queryAllEX($queryString) {
        $sql = "SELECT quickprofitclient.*, client.clientname as clientname , clientarea.name as areaName
                FROM quickprofitclient
                join  client on  client.clientid = quickprofitclient.clientId
                left join clientarea on clientarea.id = client.clientareaid
                where 1 $queryString";
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function truncate() {
        $sql = "TRUNCATE quickprofitclient";
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>