INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:00:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:30:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 09:30:24', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE programsettings SET companyname = 'GT4', address = 'المنصورة', specializtion = 'jh', phone = '01002019235', faxnumber = '0502232923', email = 'mrabozied@gt4it.com', website = 'www.gt4host.com', logo = '471502e62c0be89a8d90663028144a83.jpg', roundnumbers = '0', saveprinting = '1', deptprinting = '0', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '1', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = '0', taxcard = '332', commercialregistration = '3213123312', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '0', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2023-02-27',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='9c2d4cf4cf5d4e24d5070164705832c3a5d1287f641a2960e48e04ae57a2ad0a5441322ca7cf34efd63003fdb348adbd0b61197c7c87d8dd5bc298c352482bc6',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='1' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '1', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '0' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='first',Profitevaluation='first' , delivery='-2',premiums = '0',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',-2,-1,1,',earlyrepayment = '0',visaPay = '0',headerPrint='',headerPrintSand='',printSand='0',makeDailyEntry='0',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0' WHERE programsettingsid = '1';
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:00:25";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:00:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:30:29", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:30:29', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:04:56";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:34:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:34:56', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:07:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:37:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:37:20', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc5c15b0488
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(137,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 09:30:29', '063fc5c15b0488', '137', '745.00', '2545', '45', '1', '1845', '1800', '0', '1800', '7', '2023-02-27 09:37:21', '', '4', '0', 'جلال ابو حلا', '7', '1', '3', '0', 'جلال ابو حلا', '8' ,'0','','','','','-1','0','0','0','0','0','1800','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '2545', userid = '4' WHERE clientid = '137';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('137','745.00','1800','0','اضافة فاتورة مبيعات','10391', '2545', '2023-02-27 09:37:21', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1800', '0', null, '0', null, null,'', '0','1','1','1800','1');
UPDATE client SET  inUse = 0 where clientid = 137;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('270','01171', '10391', '1', '1171', '3', '270.00', '810', '0', '', '0', '2023-02-27 09:37:21', '1171', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where sellbilldetailid = 30286;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1171, '2023-02-27', 790.243902439, 810, 810
                    , 810, 810, 810, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790.243902439, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 790.243902439, 810, 810
                    , 810, 810, 810, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790.243902439, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '8', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '4303';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1171', '7', '3', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11.00', '8', '4', '2023-02-27 09:37:21','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10659;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('210','00514', '10391', '1', '514', '1', '150', '150', '0', '', '0', '2023-02-27 09:37:21', '514', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','10659-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 30287;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (514, '2023-02-27', 146.341463415, 150, 210
                    , 180, 210, 180, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+146.341463415, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 146.341463415, 150, 210
                    , 180, 210, 180, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+146.341463415, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '1298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '7', '1', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14.00', '13', '4', '2023-02-27 09:37:21','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('210','01041', '10391', '1', '1041', '1', '210.00', '210', '0', '', '0', '2023-02-27 09:37:21', '1041', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 30288;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1041, '2023-02-27', 204.87804878, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 204.87804878, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '22', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '3642';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1041', '7', '1', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '23.00', '22', '4', '2023-02-27 09:37:21','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 9094;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('200','01123', '10391', '1', '1123', '1', '210', '210', '0', '', '0', '2023-02-27 09:37:21', '1123', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','9094-1,');
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 200.00
                where sellbilldetailid = 30289;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1123, '2023-02-27', 204.87804878, 200, 200
                    , 200, 200, 200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 204.87804878, 200, 200
                    , 200, 200, 200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '17', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '4099';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1123', '7', '1', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '17', '4', '2023-02-27 09:37:21','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('255','01112', '10391', '1', '1112', '1', '255', '255', '0', '', '0', '2023-02-27 09:37:21', '1112', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
                where sellbilldetailid = 30290;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1112, '2023-02-27', 248.780487805, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+248.780487805, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 248.780487805, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+248.780487805, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '30', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '4050';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1112', '7', '1', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31.00', '30', '4', '2023-02-27 09:37:21','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 8818;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('210','01114', '10391', '1', '1114', '1', '210', '210', '0', '', '0', '2023-02-27 09:37:21', '1114', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','8818-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 30291;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1114, '2023-02-27', 204.87804878, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 204.87804878, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204.87804878, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '50', userid = '4', storedetaildate = '2023-02-27 09:37:21' WHERE storedetailid = '4049';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1114', '7', '1', '1', '10391', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51.00', '50', '4', '2023-02-27 09:37:21','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 1800, 1835, 1895
                    , 1865, 1895, 1865, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1835
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1895, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1865
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1895, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1865
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (137, '2023-02-27', 1800, 1835, 1895
                    , 1865, 1895, 1865, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1835
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1895, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1865
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1895, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1865
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 1800, 1835, 1895
                    , 1865, 1895, 1865, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1800, netSellCostBuyPrice = netSellCostBuyPrice+1835
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1895
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1865
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1895
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1865
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc5c15b0488 and sellbillId = 10391 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:07:21";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:37:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:37:21', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:07:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:37:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:37:33', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:09:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:39:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:39:19', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc5dbd40908
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(137,@clientdebt,@clientname);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2023-02-27 09:37:33', '063fc5dbd40908', '137', '2545.00', '-680', '0', '1', '3225', '3225', '0', '-3225', '7', '2023-02-27 09:39:19', '', '4', '0', 'جلال ابو حلا','7', '1', '5', '0', 'جلال ابو حلا', '18', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '-680', userid = '4' WHERE clientid = '137';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('137','2545.00','3225','1','اضافة فاتورة مردوات مبيعات','3709', '-680', '2023-02-27 09:39:19', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '3225', '0', null, '0', null, null,'', '0','1','1','3225','1');
UPDATE client SET  inUse = 0 where clientid = 137;
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('200.00', '00301', '3709', '1', '301', '1', '200', '200', '0', '', '0', '0', '301', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 190.00 , meanbuyprice = 195.00, lastbuyprice_withDiscount = 190.00, meanbuyprice_withDiscount = 195.00
                where returnsellbilldetailid = 7858;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (301, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 200, 200, 190, 195
                    , 190, 195, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+200, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+190
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+195, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+190
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+195
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 200, 200, 190, 195
                    , 190, 195, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+200, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+190
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+195, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+190
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+195
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '4', storedetaildate = '2023-02-27 09:39:19' WHERE storedetailid = '1793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('301', '7', '1', '0', '3709', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '-1.00', '0', '4', '2023-02-27 09:39:19','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('145.00', '00108', '3709', '1', '108', '1', '145', '145', '0', '', '0', '0', '108', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 152.50, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 152.50
                where returnsellbilldetailid = 7859;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (108, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 145, 145, 160, 152.5
                    , 160, 152.5, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+145, returnSellCostBuyPrice = returnSellCostBuyPrice+145, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+160
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+152.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+160
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+152.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 145, 145, 160, 152.5
                    , 160, 152.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+145, returnSellCostBuyPrice = returnSellCostBuyPrice+145, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+160
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+152.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+160
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+152.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '4', storedetaildate = '2023-02-27 09:39:19' WHERE storedetailid = '1874';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '7', '1', '0', '3709', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '-1.00', '0', '4', '2023-02-27 09:39:19','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('370.00', '00011', '3709', '1', '11', '16', '180', '2880', '0', '', '0', '0', '11', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 170.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 170.00, meanbuyprice_withDiscount = 270.00
                where returnsellbilldetailid = 7860;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (11, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2880, 5920, 2720, 4320
                    , 2720, 4320, 0, 0, 16)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+2880, returnSellCostBuyPrice = returnSellCostBuyPrice+5920, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2720
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2720
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+16;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2880, 5920, 2720, 4320
                    , 2720, 4320, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+2880, returnSellCostBuyPrice = returnSellCostBuyPrice+5920, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2720
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2720
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4320
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '4', storedetaildate = '2023-02-27 09:39:19' WHERE storedetailid = '1221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '7', '16', '0', '3709', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '-16.00', '0', '4', '2023-02-27 09:39:19','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 3225, 6265, 3070, 4667.5
                    , 3070, 4667.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+3225, returnSellCostBuyPrice = returnSellCostBuyPrice+6265, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3070
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4667.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3070
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4667.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (137, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 3225, 6265, 3070, 4667.5
                    , 3070, 4667.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+3225, returnSellCostBuyPrice = returnSellCostBuyPrice+6265, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3070
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4667.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3070
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4667.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -3225, -6265, -3070
                    , -4667.5, -3070, -4667.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-3225, netSellCostBuyPrice = netSellCostBuyPrice+-6265
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-3070
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-4667.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-3070
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-4667.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc5dbd40908 and sellbillId = 3709 and returnsellbillId = 3709
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:09:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:39:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:39:19', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:09:21";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:39:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:39:22', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:09:25";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:39:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 09:39:25', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:09:26";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 09:39:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 09:39:26', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:32:10";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:02:10", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:02:10', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 06:34:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:04:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:04:32', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:14:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:44:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:44:20', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc64107887e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 10:04:32', '063fc64107887e', '1', '0.00', '0', '110', '1', '910', '800', '800', '0', '7', '2023-02-27 10:44:20', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','800','0','','0','0','800','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10392', '0', '2023-02-27 10:44:20', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '800', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('230','01113', '10392', '1', '1113', '2', '230', '460', '0', '', '0', '2023-02-27 10:44:20', '1113', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 30292;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1113, '2023-02-27', 404.395604396, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+404.395604396, sellCostBuyPrice =sellCostBuyPrice+460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 404.395604396, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+404.395604396, sellCostBuyPrice =sellCostBuyPrice+460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '4', storedetaildate = '2023-02-27 10:44:20' WHERE storedetailid = '4051';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1113', '7', '2', '1', '10392', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15.00', '13', '4', '2023-02-27 10:44:20','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('230','01037', '10392', '1', '1037', '1', '230', '230', '0', '', '0', '2023-02-27 10:44:20', '1037', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 30293;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1037, '2023-02-27', 202.197802198, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+202.197802198, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 202.197802198, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+202.197802198, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '7', userid = '4', storedetaildate = '2023-02-27 10:44:20' WHERE storedetailid = '3609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1037', '7', '1', '1', '10392', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8.00', '7', '4', '2023-02-27 10:44:20','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 9050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('220','01074', '10392', '1', '1074', '1', '220', '220', '0', '', '0', '2023-02-27 10:44:20', '1074', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','9050-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 30294;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1074, '2023-02-27', 193.406593407, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+193.406593407, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 193.406593407, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+193.406593407, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '32', userid = '4', storedetaildate = '2023-02-27 10:44:20' WHERE storedetailid = '3806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1074', '7', '1', '1', '10392', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33.00', '32', '4', '2023-02-27 10:44:20','0','0');
UPDATE save SET  savecurrentvalue = '2630',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1830.00','800', '0', '7', 'اضافة فاتورة مبيعات', '10392', '2630', '2023-02-27 10:44:20', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 800, 910, 910
                    , 910, 910, 910, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 800, 910, 910
                    , 910, 910, 910, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 800, 910, 910
                    , 910, 910, 910, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+800, netSellCostBuyPrice = netSellCostBuyPrice+910
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+910
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+910
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+910
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+910
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc64107887e and sellbillId = 10392 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:14:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:44:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:44:20', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:14:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:44:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 10:44:24', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:14:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 10:44:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:44:28', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:19:57";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:49:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 10:49:57', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:19:57";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:20:12";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:50:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 10:50:12', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:20:30";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:50:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:50:30', '1', 'showDetail', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:28:36";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:58:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 10:58:37', '1', 'addsellBill', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:28:46";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:58:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 10:58:46', '1', 'edit', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:29:39";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 10:59:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 10:59:39', '1', 'show', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:30:15";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 11:00:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 11:00:16', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:30:27";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 11:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 11:00:27', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 07:30:39";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 11:00:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 11:00:39', '1', 'addsellBill', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:37:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:07:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:07:03', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:38:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:08:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:08:32', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc80c7da4df
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(128,@clientdebt,@clientname);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2023-02-27 12:07:03', '063fc80c7da4df', '128', '340.00', '-930', '0', '1', '1270', '1270', '0', '-1270', '7', '2023-02-27 12:08:32', '', '4', '0', 'ام يوسف داليا','7', '1', '5', '0', 'ام يوسف داليا', '6', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '-930', userid = '4' WHERE clientid = '128';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('128','340.00','1270','1','اضافة فاتورة مردوات مبيعات','3710', '-930', '2023-02-27 12:08:32', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1270', '0', null, '0', null, null,'', '0','1','1','1270','1');
UPDATE client SET  inUse = 0 where clientid = 128;
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('150.00', '00518', '3710', '1', '518', '3', '150.00', '450', '0', '', '0', '0', '518', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 180.00
                where returnsellbilldetailid = 7861;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (518, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 630, 540
                    , 630, 540, 0, 0, 3)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+630
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+630
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 630, 540
                    , 630, 540, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+630
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+630
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '40', userid = '4', storedetaildate = '2023-02-27 12:08:32' WHERE storedetailid = '1302';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '7', '3', '0', '3710', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '37.00', '40', '4', '2023-02-27 12:08:32','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('270.00', '01172', '3710', '1', '1172', '1', '280', '280', '0', '', '0', '0', '1172', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where returnsellbilldetailid = 7862;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1172, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 280, 270, 270, 270
                    , 270, 270, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+280, returnSellCostBuyPrice = returnSellCostBuyPrice+270, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+270
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+270, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+270
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+270
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 280, 270, 270, 270
                    , 270, 270, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+280, returnSellCostBuyPrice = returnSellCostBuyPrice+270, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+270
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+270, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+270
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+270
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '24', userid = '4', storedetaildate = '2023-02-27 12:08:32' WHERE storedetailid = '4302';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1172', '7', '1', '0', '3710', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '23.00', '24', '4', '2023-02-27 12:08:32','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('260.00', '01182', '3710', '1', '1182', '1', '270.00', '270', '0', '', '0', '0', '1182', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
                where returnsellbilldetailid = 7863;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1182, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 270, 260, 260, 260
                    , 260, 260, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+270, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 270, 260, 260, 260
                    , 260, 260, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+270, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '31', userid = '4', storedetaildate = '2023-02-27 12:08:32' WHERE storedetailid = '4360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1182', '7', '1', '0', '3710', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '30.00', '31', '4', '2023-02-27 12:08:32','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('260.00', '01165', '3710', '1', '1165', '1', '270.00', '270', '0', '', '0', '0', '1165', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
                where returnsellbilldetailid = 7864;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1165, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 270, 260, 260, 260
                    , 260, 260, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+270, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 270, 260, 260, 260
                    , 260, 260, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+270, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '10', userid = '4', storedetaildate = '2023-02-27 12:08:32' WHERE storedetailid = '4263';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1165', '7', '1', '0', '3710', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '9.00', '10', '4', '2023-02-27 12:08:32','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1270, 1240, 1420, 1330
                    , 1420, 1330, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+1270, returnSellCostBuyPrice = returnSellCostBuyPrice+1240, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1420
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1330, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1420
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1330
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (128, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1270, 1240, 1420, 1330
                    , 1420, 1330, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+1270, returnSellCostBuyPrice = returnSellCostBuyPrice+1240, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1420
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1330, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1420
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1330
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -1270, -1240, -1420
                    , -1330, -1420, -1330, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1270, netSellCostBuyPrice = netSellCostBuyPrice+-1240
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1420
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1330
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1420
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1330
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc80c7da4df and sellbillId = 3710 and returnsellbillId = 3710
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:38:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:08:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:08:32', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:38:50";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:08:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:08:50', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc6d6c61edb
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(128,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 10:44:28', '063fc6d6c61edb', '128', '-930.00', '725', '150', '1', '1805', '1655', '0', '1655', '7', '2023-02-27 12:08:50', '', '4', '0', 'ام يوسف داليا', '7', '1', '3', '0', 'ام يوسف داليا', '8' ,'0','','','','','-1','0','0','0','0','0','1655','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '725', userid = '4' WHERE clientid = '128';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('128','-930.00','1655','0','اضافة فاتورة مبيعات','10393', '725', '2023-02-27 12:08:50', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1655', '0', null, '0', null, null,'', '0','1','1','1655','1');
UPDATE client SET  inUse = 0 where clientid = 128;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('230','01037', '10393', '1', '1037', '1', '230', '230', '0', '', '0', '2023-02-27 12:08:50', '1037', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 30295;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1037, '2023-02-27', 210.886426593, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210.886426593, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 210.886426593, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210.886426593, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '6', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '3609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1037', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.00', '6', '4', '2023-02-27 12:08:50','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00967', '10393', '1', '967', '1', '205.00', '205', '0', '', '0', '2023-02-27 12:08:50', '967', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 30296;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (967, '2023-02-27', 187.96398892, 205, 205
                    , 205, 205, 205, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+187.96398892, sellCostBuyPrice =sellCostBuyPrice+205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 187.96398892, 205, 205
                    , 205, 205, 205, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+187.96398892, sellCostBuyPrice =sellCostBuyPrice+205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '43', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '3218';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('967', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44.00', '43', '4', '2023-02-27 12:08:50','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 6482;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00807', '10393', '1', '807', '1', '180.00', '180', '0', '', '0', '2023-02-27 12:08:50', '807', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','6482-1,');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 30297;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (807, '2023-02-27', 165.041551247, 190, 180
                    , 185, 180, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165.041551247, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 165.041551247, 190, 180
                    , 185, 180, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165.041551247, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '10', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '2443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('807', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11.00', '10', '4', '2023-02-27 12:08:50','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('280','01174', '10393', '1', '1174', '1', '280.00', '280', '0', '', '0', '2023-02-27 12:08:50', '1174', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 30298;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1174, '2023-02-27', 256.731301939, 280, 280
                    , 280, 280, 280, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+256.731301939, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 256.731301939, 280, 280
                    , 280, 280, 280, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+256.731301939, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '-2', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '4324';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1174', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '-1.00', '-2', '4', '2023-02-27 12:08:50','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('260','01165', '10393', '1', '1165', '1', '270.00', '270', '0', '', '0', '2023-02-27 12:08:50', '1165', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
                where sellbilldetailid = 30299;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1165, '2023-02-27', 247.56232687, 260, 260
                    , 260, 260, 260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.56232687, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 247.56232687, 260, 260
                    , 260, 260, 260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.56232687, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '4263';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1165', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10.00', '9', '4', '2023-02-27 12:08:50','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10327;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('160','01183', '10393', '1', '1183', '1', '270', '270', '0', '', '0', '2023-02-27 12:08:50', '1183', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','10327-1,');
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 30300;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1183, '2023-02-27', 247.56232687, 260, 160
                    , 210, 160, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.56232687, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 247.56232687, 260, 160
                    , 210, 160, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.56232687, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '58', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '4361';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1183', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59.00', '58', '4', '2023-02-27 12:08:50','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 6600;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('220','00998', '10393', '1', '998', '1', '220.00', '220', '0', '', '0', '2023-02-27 12:08:50', '998', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','6600-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 222.50, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 222.50
                where sellbilldetailid = 30301;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (998, '2023-02-27', 201.717451524, 225, 220
                    , 222.5, 220, 222.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+201.717451524, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+222.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+222.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 201.717451524, 225, 220
                    , 222.5, 220, 222.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+201.717451524, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+222.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+222.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '-1', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '3411';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('998', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0.00', '-1', '4', '2023-02-27 12:08:50','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2370;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('120','00348', '10393', '1', '348', '1', '150', '150', '0', '', '0', '2023-02-27 12:08:50', '348', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2370-1,');
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
                where sellbilldetailid = 30302;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (348, '2023-02-27', 137.534626039, 120, 120
                    , 120, 120, 120, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+137.534626039, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 137.534626039, 120, 120
                    , 120, 120, 120, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+137.534626039, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '11', userid = '4', storedetaildate = '2023-02-27 12:08:50' WHERE storedetailid = '1718';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('348', '7', '1', '1', '10393', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12.00', '11', '4', '2023-02-27 12:08:50','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 1655, 1770, 1655
                    , 1712.5, 1655, 1712.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1655, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1712.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1712.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (128, '2023-02-27', 1655, 1770, 1655
                    , 1712.5, 1655, 1712.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1655, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1712.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1712.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 1655, 1770, 1655
                    , 1712.5, 1655, 1712.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1655, netSellCostBuyPrice = netSellCostBuyPrice+1770
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1655
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1712.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1655
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1712.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc6d6c61edb and sellbillId = 10393 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:38:50";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:08:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:08:50', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:40:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:10:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2023-02-27 12:10:24', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:40:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:10:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2023-02-27 12:10:32', '4', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:40:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:10:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:10:35', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:40:36";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:10:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('returnsellbillController.php', '2023-02-27 12:10:36', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:41:16";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:11:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:11:16', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:42:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:12:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:12:19', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:42:53";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:12:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 12:12:53', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:43:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:13:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 12:13:20', '4', 'add', '156.206.113.168', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =15709
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(128,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '325' , clientdate = '2023-02-27 12:13:20', userid = '4' WHERE clientid = '128';
UPDATE client SET  inUse = 0 where clientid = 128;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('128','725.00','400','1','ايصال تحصيل (( قبض من عميل ))','15709', '325', '2023-02-27 12:12:53', '4', 'clientPayedDeptController.php', '   ', '400', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '3030',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2630.00','400', '0', '7', 'ايصال تحصيل (( قبض من عميل ))', '15709', '3030', '2023-02-27 12:13:20', '4',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '400', '400', '2023-02-27', '4', '0', '0', '2023-02-27 12:13:20','اضافة ايصال سداد للعميل ام يوسف داليا','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6335', '141', '400', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1097472', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6335', '204', '400', '','0');
UPDATE accountstree SET name = 'ام يوسف داليا', customName = 'ام يوسف داليا', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '4', mydate = '2022-03-09', itemtype2 = '1', theValue = '-2140', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '204';
UPDATE clientdebtchange SET clientid = '128', clientdebtchangebefore = '725.00', clientdebtchangeamount = '400.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '15709', clientdebtchangeafter = '325.00', clientdebtchangedate = '2023-02-27 12:12:53', userid = '4', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '400.00',discount='', reciptid=null, dailyentryid = '6335',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '15709';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add end - with modelid =15709 -clientdebtchangeId = 15709
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:43:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:13:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 12:13:20', '4', 'editprint2', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:43:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:13:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:13:28', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:43:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:13:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:13:32', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:56:10";
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:56:30";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:26:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 12:26:30', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:56:31";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:56:39";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:26:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:26:39', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:56:53";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:26:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 12:26:53', '1', 'editprint', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 08:57:15";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:27:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:27:16', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:01:45";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:31:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:31:45', '1', 'addsellBill', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:13:54";

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc824cd2a19
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 12:13:32', '063fc824cd2a19', '1', '0.00', '0', '125', '1', '715', '590', '590', '0', '7', '2023-02-27 12:43:54', '', null, '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','590','0','','0','0','590','0','0','0','0','0','0','0','0','');
ROLLBACK;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc824cd2a19 and sellbillId = 0 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:13:54";
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:01";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 12:44:01', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:01";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:44:03', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:44:05', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:26";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:44:26', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc8975a280b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 12:44:05', '063fc8975a280b', '1', '0.00', '0', '125', '1', '715', '590', '590', '0', '7', '2023-02-27 12:44:26', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','590','0','','0','0','590','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10394', '0', '2023-02-27 12:44:26', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '590', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10327;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('160','01183', '10394', '1', '1183', '1', '270', '270', '0', '', '0', '2023-02-27 12:44:26', '1183', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','10327-1,');
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 30303;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1183, '2023-02-27', 222.797202797, 260, 160
                    , 210, 160, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+222.797202797, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 222.797202797, 260, 160
                    , 210, 160, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+222.797202797, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '57', userid = '4', storedetaildate = '2023-02-27 12:44:26' WHERE storedetailid = '4361';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1183', '7', '1', '1', '10394', 'اضافة فاتورة مبيعات', 'sellbillController.php', '58.00', '57', '4', '2023-02-27 12:44:26','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 9984;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('270','01160', '10394', '1', '1160', '1', '270', '270', '0', '', '0', '2023-02-27 12:44:26', '1160', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','9984-1,');
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where sellbilldetailid = 30304;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1160, '2023-02-27', 222.797202797, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+222.797202797, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 222.797202797, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+222.797202797, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '43', userid = '4', storedetaildate = '2023-02-27 12:44:26' WHERE storedetailid = '4243';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1160', '7', '1', '1', '10394', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44.00', '43', '4', '2023-02-27 12:44:26','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1482;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00383', '10394', '1', '383', '1', '175', '175', '0', '', '0', '2023-02-27 12:44:26', '383', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1482-1,');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 167.50, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 167.50
                where sellbilldetailid = 30305;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (383, '2023-02-27', 144.405594406, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+144.405594406, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 144.405594406, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+144.405594406, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '12', userid = '4', storedetaildate = '2023-02-27 12:44:26' WHERE storedetailid = '1292';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '7', '1', '1', '10394', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '12', '4', '2023-02-27 12:44:26','0','0');
UPDATE save SET  savecurrentvalue = '3620',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3030.00','590', '0', '7', 'اضافة فاتورة مبيعات', '10394', '3620', '2023-02-27 12:44:26', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 590, 680, 615
                    , 647.5, 615, 647.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+590, sellCostBuyPrice =sellCostBuyPrice+680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+615, sellCostMeanBuyPrice = sellCostMeanBuyPrice+647.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+615, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+647.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 590, 680, 615
                    , 647.5, 615, 647.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+590, sellCostBuyPrice =sellCostBuyPrice+680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+615, sellCostMeanBuyPrice = sellCostMeanBuyPrice+647.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+615, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+647.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 590, 680, 615
                    , 647.5, 615, 647.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+590, netSellCostBuyPrice = netSellCostBuyPrice+680
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+615
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+647.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+615
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+647.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc8975a280b and sellbillId = 10394 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:27";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:44:27', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:44:28', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:30";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:44:31', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:44:31', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:14:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:44:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:44:43', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:25:30";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:55:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 12:55:30', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:25:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 12:55:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:55:33', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:25:41";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:55:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 12:55:41', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:25:57";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 12:55:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 12:55:57', '1', 'addsellBill', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:43:56";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:13:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 13:13:56', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:44:10";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:14:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 13:14:10', '1', 'show', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:45:15";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:15:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:15:15', '1', 'addsellBill', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:49:50";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:19:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:19:50', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc8c2557dc9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 12:55:33', '063fc8c2557dc9', '1', '0.00', '0', '0', '1', '550', '550', '550', '0', '7', '2023-02-27 13:19:51', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','550','0','','0','0','550','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10395', '0', '2023-02-27 13:19:51', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '550', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('230','01113', '10395', '1', '1113', '1', '230', '230', '0', '', '0', '2023-02-27 13:19:51', '1113', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 30306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1113, '2023-02-27', 230, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 230, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '12', userid = '4', storedetaildate = '2023-02-27 13:19:51' WHERE storedetailid = '4051';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1113', '7', '1', '1', '10395', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '12', '4', '2023-02-27 13:19:51','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('320','00647', '10395', '1', '647', '1', '320', '320', '0', '', '0', '2023-02-27 13:19:51', '647', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 304.38, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 304.38
                where sellbilldetailid = 30307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (647, '2023-02-27', 320, 320, 280
                    , 304.38, 280, 304.38, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+320, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 320, 320, 280
                    , 304.38, 280, 304.38, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+320, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '38', userid = '4', storedetaildate = '2023-02-27 13:19:51' WHERE storedetailid = '2073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '1', '1', '10395', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39.00', '38', '4', '2023-02-27 13:19:51','0','0');
UPDATE save SET  savecurrentvalue = '4170',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3620.00','550', '0', '7', 'اضافة فاتورة مبيعات', '10395', '4170', '2023-02-27 13:19:51', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 550, 550, 510
                    , 534.38, 510, 534.38, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+534.38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+534.38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 550, 550, 510
                    , 534.38, 510, 534.38, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+534.38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+534.38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 550, 550, 510
                    , 534.38, 510, 534.38, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+550, netSellCostBuyPrice = netSellCostBuyPrice+550
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+510
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+534.38
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+510
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+534.38
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc8c2557dc9 and sellbillId = 10395 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:49:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:19:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:19:51', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:49:52";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:19:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 13:19:52', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:49:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:19:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:19:55', '4', 'showDetail', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:50:09";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:20:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 13:20:10', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:50:22";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 13:20:22', '1', 'show', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:51:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:21:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 13:21:31', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 09:53:31";
UPDATE user SET loginip = "156.210.67.112", lastactivetime = "2023-02-27 13:23:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 13:23:31', '1', '', '156.210.67.112', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:00:23";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:30:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:30:23', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:00:40";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:30:40", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:30:40', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fc944fd8204
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 13:30:23', '063fc944fd8204', '1', '0.00', '0', '50', '1', '270', '220', '220', '0', '7', '2023-02-27 13:30:40', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','220','0','','0','0','220','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10396', '0', '2023-02-27 13:30:40', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '220', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('270','01161', '10396', '1', '1161', '1', '270', '270', '0', '', '0', '2023-02-27 13:30:40', '1161', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where sellbilldetailid = 30308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1161, '2023-02-27', 220, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 220, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '4', storedetaildate = '2023-02-27 13:30:40' WHERE storedetailid = '4244';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1161', '7', '1', '1', '10396', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2.00', '1', '4', '2023-02-27 13:30:40','0','0');
UPDATE save SET  savecurrentvalue = '4390',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4170.00','220', '0', '7', 'اضافة فاتورة مبيعات', '10396', '4390', '2023-02-27 13:30:40', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 220, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 220, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 220, 270, 270
                    , 270, 270, 270, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+220, netSellCostBuyPrice = netSellCostBuyPrice+270
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+270
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+270
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+270
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+270
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fc944fd8204 and sellbillId = 10396 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:00:40";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:30:40", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:30:40', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:00:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:30:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 13:30:42', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:01:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 13:31:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 13:31:07', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:30:53";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:00:54", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 14:00:54', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:30:57";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:00:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:00:57', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:31:28";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:01:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:01:28', '1', 'add', '156.210.80.14', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(1275,4,7,1128,1,'2023-02-27',1,0, '' ,0,0,0,0,0,'2023-02-27 14:01:28',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4130';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1128, 0, 0
                    , 200.00, -1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*200.00," WHERE transferproductid = 5775;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1128', '4', '1', '1', '5775', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4128';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1128, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1128', '7', '1', '0', '5775', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '31.00', '32', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1125', '15', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4108';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-18', 4, 1125, 0, 0
                    , 210.00, 11, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1125, 0, 0
                    , 210.00, -4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-08-18*210.00,4*2023-02-27*210.00," WHERE transferproductid = 5776;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1125', '4', '15', '1', '5776', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4102';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-18', 7, 1125, 0, 0
                    , 210.00, 11, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1125, 0, 0
                    , 210.00, 4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1125', '7', '15', '0', '5776', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '21', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1123', '9', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4107';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-18', 4, 1123, 0, 0
                    , 200.00, 4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-4, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1123, 0, 0
                    , 200.00, -5, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2022-08-18*200.00,5*2023-02-27*200.00," WHERE transferproductid = 5777;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1123', '4', '9', '1', '5777', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4099';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-18', 7, 1123, 0, 0
                    , 200.00, 4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1123, 0, 0
                    , 200.00, 5, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1123', '7', '9', '0', '5777', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '17.00', '26', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1119', '4', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4082';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1119, 0, 0
                    , 210.00, -4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*210.00," WHERE transferproductid = 5778;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1119', '4', '4', '1', '5778', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4080';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1119, 0, 0
                    , 210.00, 4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1119', '7', '4', '0', '5778', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '4', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1118', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4078';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1118, 0, 0
                    , 200.00, -2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*200.00," WHERE transferproductid = 5779;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1118', '4', '2', '1', '5779', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4079';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1118, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1118', '7', '2', '0', '5779', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '192', '33', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4077';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 192, 0, 0
                    , 155.00, 31, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-31, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 192, 0, 0
                    , 155.00, -2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-07-21*155.00,2*2023-02-27*155.00," WHERE transferproductid = 5780;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('192', '4', '33', '1', '5780', 'تحويل منتجات من المخزن', 'storemovementController.php', '33.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4061';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 192, 0, 0
                    , 155.00, 31, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 192, 0, 0
                    , 155.00, 2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('192', '7', '33', '0', '5780', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '-1.00', '32', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '428', '10', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4076';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 428, 0, 0
                    , 170.00, 9, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-9, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 428, 0, 0
                    , 170.00, -1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2022-07-21*170.00,1*2023-02-27*170.00," WHERE transferproductid = 5781;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '4', '10', '1', '5781', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('428', '7', '10', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 428, 0, 0
                    , 170.00, 9, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 428, 0, 0
                    , 170.00, 1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '7', '10', '0', '5781', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '10', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '421', '23', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4075';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 421, 0, 0
                    , 145.00, 19, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-19, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 421, 0, 0
                    , 145.00, -4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "19*2022-07-21*145.00,4*2023-02-27*145.00," WHERE transferproductid = 5782;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '4', '23', '1', '5782', 'تحويل منتجات من المخزن', 'storemovementController.php', '23.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('421', '7', '23', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 421, 0, 0
                    , 145.00, 19, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 421, 0, 0
                    , 145.00, 4, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '7', '23', '0', '5782', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '626', '22', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4074';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 626, 0, 0
                    , 185.00, 22, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-22, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-07-21*185.00," WHERE transferproductid = 5783;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('626', '4', '22', '1', '5783', 'تحويل منتجات من المخزن', 'storemovementController.php', '22.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('626', '7', '22', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 626, 0, 0
                    , 185.00, 22, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('626', '7', '22', '0', '5783', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '12', '17', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4073';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 12, 0, 0
                    , 145.00, 10, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 12, 0, 0
                    , 145.00, -7, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2022-07-21*145.00,7*2023-02-27*145.00," WHERE transferproductid = 5784;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '4', '17', '1', '5784', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1222';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 12, 0, 0
                    , 145.00, 10, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 12, 0, 0
                    , 145.00, 7, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '7', '17', '0', '5784', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '19.00', '36', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '620', '22', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4072';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 620, 0, 0
                    , 185.00, 22, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-22, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-07-21*185.00," WHERE transferproductid = 5785;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('620', '4', '22', '1', '5785', 'تحويل منتجات من المخزن', 'storemovementController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4060';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 620, 0, 0
                    , 185.00, 22, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('620', '7', '22', '0', '5785', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '22', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1112', '13', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4071';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 1112, 0, 0
                    , 255.00, 8, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-8, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1112, 0, 0
                    , 255.00, -5, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 255.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2022-07-21*255.00,5*2023-02-27*255.00," WHERE transferproductid = 5786;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1112', '4', '13', '1', '5786', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4050';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 1112, 0, 0
                    , 255.00, 8, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1112, 0, 0
                    , 255.00, 5, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1112', '7', '13', '0', '5786', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '30.00', '43', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1114', '7', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4070';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 1114, 0, 0
                    , 210.00, 6, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1114, 0, 0
                    , 210.00, -1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2022-07-21*210.00,1*2023-02-27*210.00," WHERE transferproductid = 5787;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1114', '4', '7', '1', '5787', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4049';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 1114, 0, 0
                    , 210.00, 6, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1114, 0, 0
                    , 210.00, 1, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1114', '7', '7', '0', '5787', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '50.00', '57', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1117', '15', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:28',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4007';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 1117, 0, 0
                    , 160.00, 13, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-13, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1117, 0, 0
                    , 160.00, -2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2022-07-21*160.00,2*2023-02-27*160.00," WHERE transferproductid = 5788;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1117', '4', '15', '1', '5788', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1117', '7', '15', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 1117, 0, 0
                    , 160.00, 13, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1117, 0, 0
                    , 160.00, 2, 0, 0, 1, '2023-02-27 14:01:28')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:28' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1117', '7', '15', '0', '5788', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '15', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '17', '16', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4005';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 4, 17, 0, 0
                    , 185.00, 12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-12, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 17, 0, 0
                    , 185.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12*2022-07-19*185.00,4*2023-02-27*185.00," WHERE transferproductid = 5789;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '4', '16', '1', '5789', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1226';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 7, 17, 0, 0
                    , 185.00, 12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 17, 0, 0
                    , 185.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '7', '16', '0', '5789', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '22.00', '38', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '418', '18', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4004';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 4, 418, 0, 0
                    , 140.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-17, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 418, 0, 0
                    , 140.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2022-07-19*140.00,1*2023-02-27*140.00," WHERE transferproductid = 5790;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('418', '4', '18', '1', '5790', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3074';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 7, 418, 0, 0
                    , 140.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 418, 0, 0
                    , 140.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('418', '7', '18', '0', '5790', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '19', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '681', '35', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4003';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 4, 681, 0, 0
                    , 155.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 681, 0, 0
                    , 155.00, -12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-07-19*155.00,12*2023-02-27*155.00," WHERE transferproductid = 5791;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '4', '35', '1', '5791', 'تحويل منتجات من المخزن', 'storemovementController.php', '35.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3992';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 7, 681, 0, 0
                    , 155.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 681, 0, 0
                    , 155.00, 12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '7', '35', '0', '5791', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '36', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1111', '17', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3985';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-03', 4, 1111, 0, 0
                    , 210.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1111, 0, 0
                    , 210.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-07-03*210.00,2*2023-02-27*210.00," WHERE transferproductid = 5792;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1111', '4', '17', '1', '5792', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3983';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-03', 7, 1111, 0, 0
                    , 210.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1111, 0, 0
                    , 210.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1111', '7', '17', '0', '5792', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '25.00', '42', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1109', '3', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3961';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 4, 1109, 0, 0
                    , 235.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-06-26*235.00," WHERE transferproductid = 5793;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1109', '4', '3', '1', '5793', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3951';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 7, 1109, 0, 0
                    , 235.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1109', '7', '3', '0', '5793', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '3.00', '6', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1106', '8', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3960';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 4, 1106, 0, 0
                    , 235.00, 8, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-8, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2022-06-26*235.00," WHERE transferproductid = 5794;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1106', '4', '8', '1', '5794', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3950';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 7, 1106, 0, 0
                    , 235.00, 8, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1106', '7', '8', '0', '5794', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '8', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1104', '48', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3959';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 4, 1104, 0, 0
                    , 240.00, 48, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-48, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "48*2022-06-26*240.00," WHERE transferproductid = 5795;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1104', '4', '48', '1', '5795', 'تحويل منتجات من المخزن', 'storemovementController.php', '48.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '112', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3947';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-26', 7, 1104, 0, 0
                    , 240.00, 48, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1104', '7', '48', '0', '5795', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '64.00', '112', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '802', '3', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3937';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 802, 0, 0
                    , 180.00, -3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2023-02-27*180.00," WHERE transferproductid = 5796;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('802', '4', '3', '1', '5796', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2453';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 802, 0, 0
                    , 180.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('802', '7', '3', '0', '5796', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '7', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1090', '18', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3891';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-23', 4, 1090, 0, 0
                    , 200.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1090, 0, 0
                    , 200.00, -3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-06-23*200.00,3*2023-02-27*200.00," WHERE transferproductid = 5797;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1090', '4', '18', '1', '5797', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3893';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-23', 7, 1090, 0, 0
                    , 200.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1090, 0, 0
                    , 200.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1090', '7', '18', '0', '5797', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '18.00', '36', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '638', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3890';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 638, 0, 0
                    , 180.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*180.00," WHERE transferproductid = 5798;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '4', '2', '1', '5798', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2061';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 638, 0, 0
                    , 180.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '7', '2', '0', '5798', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1097', '3', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3886';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-22', 4, 1097, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-06-22*160.00," WHERE transferproductid = 5799;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1097', '4', '3', '1', '5799', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3884';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-22', 7, 1097, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1097', '7', '3', '0', '5799', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1077', '18', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3875';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 4, 1077, 0, 0
                    , 350.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1077, 0, 0
                    , 350.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 350.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-06-21*350.00,2*2023-02-27*350.00," WHERE transferproductid = 5800;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1077', '4', '18', '1', '5800', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3865';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 7, 1077, 0, 0
                    , 350.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1077, 0, 0
                    , 350.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1077', '7', '18', '0', '5800', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '22.00', '40', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1092', '10', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3874';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 4, 1092, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1092, 0, 0
                    , 235.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2022-06-21*235.00,5*2023-02-27*235.00," WHERE transferproductid = 5801;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1092', '4', '10', '1', '5801', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3864';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 7, 1092, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1092, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1092', '7', '10', '0', '5801', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '16', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1091', '20', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3873';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 4, 1091, 0, 0
                    , 235.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1091, 0, 0
                    , 235.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-06-21*235.00,5*2023-02-27*235.00," WHERE transferproductid = 5802;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1091', '4', '20', '1', '5802', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3863';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 7, 1091, 0, 0
                    , 235.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1091, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1091', '7', '20', '0', '5802', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '40', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1078', '5', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3872';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 4, 1078, 0, 0
                    , 220.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1078, 0, 0
                    , 220.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-06-21*220.00,4*2023-02-27*220.00," WHERE transferproductid = 5803;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1078', '4', '5', '1', '5803', 'تحويل منتجات من المخزن', 'storemovementController.php', '5.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3862';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-21', 7, 1078, 0, 0
                    , 220.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1078, 0, 0
                    , 220.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1078', '7', '5', '0', '5803', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '36.00', '41', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '602', '15', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3733';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-08', 4, 602, 0, 0
                    , 185.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-06-08*185.00," WHERE transferproductid = 5804;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('602', '4', '15', '1', '5804', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4059';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-08', 7, 602, 0, 0
                    , 185.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('602', '7', '15', '0', '5804', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '30', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1062', '20', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3724';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-10', 4, 1062, 0, 0
                    , 265.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1062, 0, 0
                    , 265.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 265.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-06-10*265.00,5*2023-02-27*265.00," WHERE transferproductid = 5805;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1062', '4', '20', '1', '5805', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3726';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-10', 7, 1062, 0, 0
                    , 265.00, 15, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1062, 0, 0
                    , 265.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1062', '7', '20', '0', '5805', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '34.00', '54', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1060', '36', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3718';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-04', 4, 1060, 0, 0
                    , 265.00, 29, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-29, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1060, 0, 0
                    , 265.00, -7, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 265.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29*2022-06-04*265.00,7*2023-02-27*265.00," WHERE transferproductid = 5806;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1060', '4', '36', '1', '5806', 'تحويل منتجات من المخزن', 'storemovementController.php', '36.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3716';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-04', 7, 1060, 0, 0
                    , 265.00, 29, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1060, 0, 0
                    , 265.00, 7, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1060', '7', '36', '0', '5806', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '26.00', '62', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '413', '26', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3708';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 413, 0, 0
                    , 140.00, -26, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2023-02-27*140.00," WHERE transferproductid = 5807;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('413', '4', '26', '1', '5807', 'تحويل منتجات من المخزن', 'storemovementController.php', '26.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3278';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 413, 0, 0
                    , 140.00, 26, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('413', '7', '26', '0', '5807', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '27', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '3', '4', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3707';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 3, 0, 0
                    , 155.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*155.00," WHERE transferproductid = 5808;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '4', '4', '1', '5808', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1214';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 3, 0, 0
                    , 155.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '7', '4', '0', '5808', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '13.00', '17', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1050', '6', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3695';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-31', 4, 1050, 0, 0
                    , 230.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1050, 0, 0
                    , 230.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 230.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-05-31*230.00,5*2023-02-27*230.00," WHERE transferproductid = 5809;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1050', '4', '6', '1', '5809', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3694';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-31', 7, 1050, 0, 0
                    , 230.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1050, 0, 0
                    , 230.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1050', '7', '6', '0', '5809', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '21', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '656', '13', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3693';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 656, 0, 0
                    , 200.00, -13, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2023-02-27*200.00," WHERE transferproductid = 5810;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '4', '13', '1', '5810', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2688';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 656, 0, 0
                    , 200.00, 13, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '7', '13', '0', '5810', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '22', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '748', '8', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3692';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 748, 0, 0
                    , 185.00, -8, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2023-02-27*185.00," WHERE transferproductid = 5811;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '4', '8', '1', '5811', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2409';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 748, 0, 0
                    , 185.00, 8, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '7', '8', '0', '5811', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '14.00', '22', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '593', '17', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3691';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 593, 0, 0
                    , 200.00, -17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2023-02-27*200.00," WHERE transferproductid = 5812;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '4', '17', '1', '5812', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2867';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 593, 0, 0
                    , 200.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '7', '17', '0', '5812', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '765', '4', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3690';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 765, 0, 0
                    , 220.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*220.00," WHERE transferproductid = 5813;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '4', '4', '1', '5813', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3284';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 765, 0, 0
                    , 220.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '7', '4', '0', '5813', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '14', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1047', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3649';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1047, 0, 0
                    , 200.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*200.00," WHERE transferproductid = 5814;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1047', '4', '2', '1', '5814', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3643';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1047, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1047', '7', '2', '0', '5814', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1041', '11', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3648';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-29', 4, 1041, 0, 0
                    , 210.00, 11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-05-29*210.00," WHERE transferproductid = 5815;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1041', '4', '11', '1', '5815', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3642';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-29', 7, 1041, 0, 0
                    , 210.00, 11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1041', '7', '11', '0', '5815', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '22.00', '33', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '432', '23', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3647';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-29', 4, 432, 0, 0
                    , 125.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-05-29*125.00," WHERE transferproductid = 5816;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('432', '4', '23', '1', '5816', 'تحويل منتجات من المخزن', 'storemovementController.php', '23.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3773';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-29', 7, 432, 0, 0
                    , 125.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('432', '7', '23', '0', '5816', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1037', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3606';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1037, 0, 0
                    , 230.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 230.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*230.00," WHERE transferproductid = 5817;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1037', '4', '1', '1', '5817', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3609';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1037, 0, 0
                    , 230.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1037', '7', '1', '0', '5817', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '7', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1021', '9', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3565';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1021, 0, 0
                    , 290.00, -9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 290.00,
                        buyQuantity =buyQuantity+-9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2023-02-27*290.00," WHERE transferproductid = 5818;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1021', '4', '9', '1', '5818', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3566';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1021, 0, 0
                    , 290.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1021', '7', '9', '0', '5818', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '35.00', '44', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1018', '9', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3528';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-14', 4, 1018, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1018, 0, 0
                    , 235.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2022-05-14*235.00,4*2023-02-27*235.00," WHERE transferproductid = 5819;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1018', '4', '9', '1', '5819', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3525';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-14', 7, 1018, 0, 0
                    , 235.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1018, 0, 0
                    , 235.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1018', '7', '9', '0', '5819', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '14.00', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1019', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3527';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1019, 0, 0
                    , 210.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*210.00," WHERE transferproductid = 5820;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1019', '4', '1', '1', '5820', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3524';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1019, 0, 0
                    , 210.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1019', '7', '1', '0', '5820', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '3.00', '4', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1017', '10', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3499';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-11', 4, 1017, 0, 0
                    , 235.00, 6, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1017, 0, 0
                    , 235.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2022-05-11*235.00,4*2023-02-27*235.00," WHERE transferproductid = 5821;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1017', '4', '10', '1', '5821', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3498';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-11', 7, 1017, 0, 0
                    , 235.00, 6, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1017, 0, 0
                    , 235.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1017', '7', '10', '0', '5821', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '11.00', '21', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1015', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3494';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1015, 0, 0
                    , 200.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*200.00," WHERE transferproductid = 5822;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1015', '4', '1', '1', '5822', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3487';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1015, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1015', '7', '1', '0', '5822', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '25.00', '26', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '943', '12', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3492';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-11', 4, 943, 0, 0
                    , 200.00, 10, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 943, 0, 0
                    , 200.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2022-05-11*200.00,2*2023-02-27*200.00," WHERE transferproductid = 5823;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('943', '4', '12', '1', '5823', 'تحويل منتجات من المخزن', 'storemovementController.php', '12.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('943', '7', '12', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-05-11', 7, 943, 0, 0
                    , 200.00, 10, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 943, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('943', '7', '12', '0', '5823', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '12', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1012', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3467';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1012, 0, 0
                    , 210.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*210.00," WHERE transferproductid = 5824;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1012', '4', '2', '1', '5824', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3469';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1012, 0, 0
                    , 210.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1012', '7', '2', '0', '5824', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '25.00', '27', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '467', '19', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3466';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-28', 4, 467, 0, 0
                    , 165.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 467, 0, 0
                    , 165.00, -3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-04-28*165.00,3*2023-02-27*165.00," WHERE transferproductid = 5825;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('467', '4', '19', '1', '5825', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3078';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-28', 7, 467, 0, 0
                    , 165.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 467, 0, 0
                    , 165.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('467', '7', '19', '0', '5825', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '28', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '643', '9', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3416';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 643, 0, 0
                    , 170.00, -9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2023-02-27*170.00," WHERE transferproductid = 5826;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '4', '9', '1', '5826', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '69', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2072';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 643, 0, 0
                    , 170.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '7', '9', '0', '5826', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '60.00', '69', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '995', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3415';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 995, 0, 0
                    , 220.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*220.00," WHERE transferproductid = 5827;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('995', '4', '2', '1', '5827', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3414';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 995, 0, 0
                    , 220.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('995', '7', '2', '0', '5827', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '5.00', '7', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '801', '4', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3386';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 801, 0, 0
                    , 190.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*190.00," WHERE transferproductid = 5828;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('801', '4', '4', '1', '5828', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2442';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 801, 0, 0
                    , 190.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('801', '7', '4', '0', '5828', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '24', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '945', '10', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3348';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-19', 4, 945, 0, 0
                    , 200.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 945, 0, 0
                    , 200.00, -7, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-04-19*200.00,7*2023-02-27*200.00," WHERE transferproductid = 5829;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('945', '4', '10', '1', '5829', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3345';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-19', 7, 945, 0, 0
                    , 200.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 945, 0, 0
                    , 200.00, 7, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('945', '7', '10', '0', '5829', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '32.00', '42', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '978', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3331';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 978, 0, 0
                    , 200.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*200.00," WHERE transferproductid = 5830;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('978', '4', '1', '1', '5830', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3335';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 978, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('978', '7', '1', '0', '5830', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '5', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '941', '14', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3330';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-19', 4, 941, 0, 0
                    , 200.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-9, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 941, 0, 0
                    , 200.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2022-04-19*200.00,5*2023-02-27*200.00," WHERE transferproductid = 5831;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('941', '4', '14', '1', '5831', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '49', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3334';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-19', 7, 941, 0, 0
                    , 200.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 941, 0, 0
                    , 200.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('941', '7', '14', '0', '5831', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '35.00', '49', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '977', '4', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3302';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 977, 0, 0
                    , 165.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 977, 0, 0
                    , 165.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2022-04-18*165.00,2*2023-02-27*165.00," WHERE transferproductid = 5832;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('977', '4', '4', '1', '5832', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('977', '7', '4', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 977, 0, 0
                    , 165.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 977, 0, 0
                    , 165.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('977', '7', '4', '0', '5832', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '4', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '575', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3301';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 575, 0, 0
                    , 185.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*185.00," WHERE transferproductid = 5833;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('575', '4', '2', '1', '5833', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2689';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 575, 0, 0
                    , 185.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('575', '7', '2', '0', '5833', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '798', '22', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3300';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 798, 0, 0
                    , 130.00, 22, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-22, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-04-18*130.00," WHERE transferproductid = 5834;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('798', '4', '22', '1', '5834', 'تحويل منتجات من المخزن', 'storemovementController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3271';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 798, 0, 0
                    , 130.00, 22, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('798', '7', '22', '0', '5834', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '29.00', '51', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '25', '16', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3299';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 25, 0, 0
                    , 170.00, 14, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 25, 0, 0
                    , 170.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2022-04-18*170.00,2*2023-02-27*170.00," WHERE transferproductid = 5835;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('25', '4', '16', '1', '5835', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1234';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 25, 0, 0
                    , 170.00, 14, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 25, 0, 0
                    , 170.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('25', '7', '16', '0', '5835', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '17', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '534', '12', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3298';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 534, 0, 0
                    , 195.00, 11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 534, 0, 0
                    , 195.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-04-18*195.00,1*2023-02-27*195.00," WHERE transferproductid = 5836;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('534', '4', '12', '1', '5836', 'تحويل منتجات من المخزن', 'storemovementController.php', '12.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('534', '7', '12', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 534, 0, 0
                    , 195.00, 11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 534, 0, 0
                    , 195.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('534', '7', '12', '0', '5836', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '12', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '76', '14', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3297';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 76, 0, 0
                    , 200.00, 12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-12, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 76, 0, 0
                    , 200.00, -2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12*2022-04-18*200.00,2*2023-02-27*200.00," WHERE transferproductid = 5837;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('76', '4', '14', '1', '5837', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1247';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 76, 0, 0
                    , 200.00, 12, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 76, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('76', '7', '14', '0', '5837', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '14', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '2', '8', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3296';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 2, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 2, 0, 0
                    , 175.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-04-18*175.00,5*2023-02-27*175.00," WHERE transferproductid = 5838;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '4', '8', '1', '5838', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1213';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 2, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 2, 0, 0
                    , 175.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '7', '8', '0', '5838', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '526', '19', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3295';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 526, 0, 0
                    , 195.00, 18, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-18, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 526, 0, 0
                    , 195.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18*2022-04-18*195.00,1*2023-02-27*195.00," WHERE transferproductid = 5839;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('526', '4', '19', '1', '5839', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3996';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 526, 0, 0
                    , 195.00, 18, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 526, 0, 0
                    , 195.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('526', '7', '19', '0', '5839', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '17.00', '36', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '531', '17', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3294';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 531, 0, 0
                    , 195.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 531, 0, 0
                    , 195.00, -1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-04-18*195.00,1*2023-02-27*195.00," WHERE transferproductid = 5840;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '4', '17', '1', '5840', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3268';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 531, 0, 0
                    , 195.00, 16, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 531, 0, 0
                    , 195.00, 1, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '7', '17', '0', '5840', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '13.00', '30', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '80', '22', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3293';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 4, 80, 0, 0
                    , 200.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-17, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 80, 0, 0
                    , 200.00, -5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2022-04-18*200.00,5*2023-02-27*200.00," WHERE transferproductid = 5841;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '4', '22', '1', '5841', 'تحويل منتجات من المخزن', 'storemovementController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1251';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-18', 7, 80, 0, 0
                    , 200.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 80, 0, 0
                    , 200.00, 5, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '7', '22', '0', '5841', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '3.00', '25', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '569', '29', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3224';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 4, 569, 0, 0
                    , 210.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 569, 0, 0
                    , 210.00, -6, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-04-15*210.00,6*2023-02-27*210.00," WHERE transferproductid = 5842;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '4', '29', '1', '5842', 'تحويل منتجات من المخزن', 'storemovementController.php', '29.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2064';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 7, 569, 0, 0
                    , 210.00, 23, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 569, 0, 0
                    , 210.00, 6, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '7', '29', '0', '5842', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '31', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '527', '13', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3223';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 4, 527, 0, 0
                    , 195.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-9, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 527, 0, 0
                    , 195.00, -4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2022-04-15*195.00,4*2023-02-27*195.00," WHERE transferproductid = 5843;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '4', '13', '1', '5843', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3219';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 7, 527, 0, 0
                    , 195.00, 9, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 527, 0, 0
                    , 195.00, 4, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '7', '13', '0', '5843', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '33', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '967', '11', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3222';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 967, 0, 0
                    , 205.00, -11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2023-02-27*205.00," WHERE transferproductid = 5844;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('967', '4', '11', '1', '5844', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3218';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 967, 0, 0
                    , 205.00, 11, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('967', '7', '11', '0', '5844', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '43.00', '54', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '18', '23', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:29',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3221';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 4, 18, 0, 0
                    , 185.00, 17, 0, 0, 1, '2023-02-27 14:01:29')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-17, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:29' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 18, 0, 0
                    , 185.00, -6, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2022-04-15*185.00,6*2023-02-27*185.00," WHERE transferproductid = 5845;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('18', '4', '23', '1', '5845', 'تحويل منتجات من المخزن', 'storemovementController.php', '23.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1227';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-15', 7, 18, 0, 0
                    , 185.00, 17, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 18, 0, 0
                    , 185.00, 6, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('18', '7', '23', '0', '5845', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '28.00', '51', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '956', '3', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3184';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 956, 0, 0
                    , 200.00, -3, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2023-02-27*200.00," WHERE transferproductid = 5846;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('956', '4', '3', '1', '5846', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3181';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 956, 0, 0
                    , 200.00, 3, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('956', '7', '3', '0', '5846', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '-1.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '958', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3180';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-14', 4, 958, 0, 0
                    , 205.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-06-14*205.00," WHERE transferproductid = 5847;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('958', '4', '1', '1', '5847', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3175';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-14', 7, 958, 0, 0
                    , 205.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('958', '7', '1', '0', '5847', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '11.00', '12', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '963', '11', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3179';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-13', 4, 963, 0, 0
                    , 200.00, 10, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 963, 0, 0
                    , 200.00, -1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2022-04-13*200.00,1*2023-02-27*200.00," WHERE transferproductid = 5848;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('963', '4', '11', '1', '5848', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3174';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-13', 7, 963, 0, 0
                    , 200.00, 10, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 963, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('963', '7', '11', '0', '5848', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '20', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '964', '7', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3178';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 964, 0, 0
                    , 200.00, -7, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "7*2023-02-27*200.00," WHERE transferproductid = 5849;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '4', '7', '1', '5849', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '84', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3173';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 964, 0, 0
                    , 200.00, 7, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '7', '7', '0', '5849', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '77.00', '84', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '959', '13', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3177';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-13', 4, 959, 0, 0
                    , 200.00, 9, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-9, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 959, 0, 0
                    , 200.00, -4, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2022-04-13*200.00,4*2023-02-27*200.00," WHERE transferproductid = 5850;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('959', '4', '13', '1', '5850', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3172';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-13', 7, 959, 0, 0
                    , 200.00, 9, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 959, 0, 0
                    , 200.00, 4, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('959', '7', '13', '0', '5850', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '18.00', '31', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '957', '7', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3176';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 957, 0, 0
                    , 200.00, -7, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "7*2023-02-27*200.00," WHERE transferproductid = 5851;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('957', '4', '7', '1', '5851', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3182';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 957, 0, 0
                    , 200.00, 7, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('957', '7', '7', '0', '5851', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '21.00', '28', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '924', '2', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2959';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 924, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2022-04-08*200.00," WHERE transferproductid = 5852;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('924', '4', '2', '1', '5852', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2990';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 924, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('924', '7', '2', '0', '5852', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '922', '18', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2957';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 922, 0, 0
                    , 200.00, 17, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-17, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 922, 0, 0
                    , 200.00, -1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2022-04-08*200.00,1*2023-02-27*200.00," WHERE transferproductid = 5853;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('922', '4', '18', '1', '5853', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3257';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 922, 0, 0
                    , 200.00, 17, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 922, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('922', '7', '18', '0', '5853', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '18', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '861', '5', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2956';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 861, 0, 0
                    , 210.00, 4, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-4, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 861, 0, 0
                    , 210.00, -1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2022-04-08*210.00,1*2023-02-27*210.00," WHERE transferproductid = 5854;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('861', '4', '5', '1', '5854', 'تحويل منتجات من المخزن', 'storemovementController.php', '5.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3256';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 861, 0, 0
                    , 210.00, 4, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 861, 0, 0
                    , 210.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('861', '7', '5', '0', '5854', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '20', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '923', '1', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2958';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 923, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-04-08*200.00," WHERE transferproductid = 5855;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('923', '4', '1', '1', '5855', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2989';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 923, 0, 0
                    , 200.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('923', '7', '1', '0', '5855', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '1', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '669', '33', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2955';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 669, 0, 0
                    , 180.00, 25, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-25, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 669, 0, 0
                    , 180.00, -8, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "25*2022-04-08*180.00,8*2023-02-27*180.00," WHERE transferproductid = 5856;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '4', '33', '1', '5856', 'تحويل منتجات من المخزن', 'storemovementController.php', '33.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2062';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 669, 0, 0
                    , 180.00, 25, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 669, 0, 0
                    , 180.00, 8, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '7', '33', '0', '5856', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '39', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '597', '23', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2954';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 597, 0, 0
                    , 190.00, 23, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-04-08*190.00," WHERE transferproductid = 5857;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('597', '4', '23', '1', '5857', 'تحويل منتجات من المخزن', 'storemovementController.php', '23.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('597', '7', '23', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 597, 0, 0
                    , 190.00, 23, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('597', '7', '23', '0', '5857', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '22', '8', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2953';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 22, 0, 0
                    , 175.00, 5, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 22, 0, 0
                    , 175.00, -3, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2022-04-08*175.00,3*2023-02-27*175.00," WHERE transferproductid = 5858;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '4', '8', '1', '5858', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1231';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 22, 0, 0
                    , 175.00, 5, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 22, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '7', '8', '0', '5858', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '8', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '242', '25', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '707';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 242, 0, 0
                    , 190.00, 25, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-25, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "25*2021-11-08*190.00," WHERE transferproductid = 5859;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '4', '25', '1', '5859', 'تحويل منتجات من المخزن', 'storemovementController.php', '25.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1846';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 242, 0, 0
                    , 190.00, 25, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '7', '25', '0', '5859', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '25', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '570', '28', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2951';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 570, 0, 0
                    , 210.00, 27, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-27, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 570, 0, 0
                    , 210.00, -1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2022-04-08*210.00,1*2023-02-27*210.00," WHERE transferproductid = 5860;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '4', '28', '1', '5860', 'تحويل منتجات من المخزن', 'storemovementController.php', '28.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2055';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 570, 0, 0
                    , 210.00, 27, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 570, 0, 0
                    , 210.00, 1, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '7', '28', '0', '5860', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '40.00', '68', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '6', '34', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2950';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 6, 0, 0
                    , 145.00, 16, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 6, 0, 0
                    , 145.00, -18, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-04-08*145.00,18*2023-02-27*145.00," WHERE transferproductid = 5861;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '4', '34', '1', '5861', 'تحويل منتجات من المخزن', 'storemovementController.php', '34.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1216';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 6, 0, 0
                    , 145.00, 16, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 6, 0, 0
                    , 145.00, 18, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '7', '34', '0', '5861', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '34', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '501', '16', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2948';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 501, 0, 0
                    , 165.00, 16, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-04-08*165.00," WHERE transferproductid = 5862;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('501', '4', '16', '1', '5862', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('501', '7', '16', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 501, 0, 0
                    , 165.00, 16, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('501', '7', '16', '0', '5862', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '16', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '419', '32', '2023-02-27', '1', '0','1275',null,null,'2023-02-27 14:01:30',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2947';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 419, 0, 0
                    , 145.00, 32, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-32, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-04-08*145.00," WHERE transferproductid = 5863;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '4', '32', '1', '5863', 'تحويل منتجات من المخزن', 'storemovementController.php', '32.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('419', '7', '32', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 419, 0, 0
                    , 145.00, 32, 0, 0, 1, '2023-02-27 14:01:30')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:01:30' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '7', '32', '0', '5863', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2023-02-27','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:31:30";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:01:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:01:30', '1', 'editshow', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:32:12";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:02:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:02:12', '1', '', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:32:28";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:02:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:02:28', '1', 'show', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:32:31";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:02:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:02:31', '1', 'editorder', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:32:55";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:02:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:02:56', '1', '', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:50:12";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:20:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:20:12', '1', 'add', '156.210.80.14', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(1276,4,7,1,17,'2023-02-27',1,0, '' ,0,0,0,0,0,'2023-02-27 14:20:13',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2946';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 1, 0, 0
                    , 150.00, 9, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-9, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1, 0, 0
                    , 150.00, -8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "9*2022-04-08*150.00,8*2023-02-27*150.00," WHERE transferproductid = 5864;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '4', '17', '1', '5864', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1212';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 1, 0, 0
                    , 150.00, 9, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+9, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1, 0, 0
                    , 150.00, 8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '7', '17', '0', '5864', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '37', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '146', '2', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2945';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 146, 0, 0
                    , 180.00, -2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*180.00," WHERE transferproductid = 5865;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '4', '2', '1', '5865', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3991';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 146, 0, 0
                    , 180.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '7', '2', '0', '5865', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '31.00', '33', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '423', '18', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2944';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 423, 0, 0
                    , 145.00, 15, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 423, 0, 0
                    , 145.00, -3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2022-04-08*145.00,3*2023-02-27*145.00," WHERE transferproductid = 5866;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('423', '4', '18', '1', '5866', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4057';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 423, 0, 0
                    , 145.00, 15, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 423, 0, 0
                    , 145.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('423', '7', '18', '0', '5866', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '28', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '420', '15', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2943';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 420, 0, 0
                    , 145.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 420, 0, 0
                    , 145.00, -4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-04-08*145.00,4*2023-02-27*145.00," WHERE transferproductid = 5867;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('420', '4', '15', '1', '5867', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3273';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 420, 0, 0
                    , 145.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 420, 0, 0
                    , 145.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('420', '7', '15', '0', '5867', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '19', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '20', '19', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2942';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 20, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 20, 0, 0
                    , 175.00, -16, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-04-08*175.00,16*2023-02-27*175.00," WHERE transferproductid = 5868;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '4', '19', '1', '5868', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1229';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 20, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 20, 0, 0
                    , 175.00, 16, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '7', '19', '0', '5868', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '19', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '634', '44', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2941';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 634, 0, 0
                    , 210.00, 22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-22, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 634, 0, 0
                    , 210.00, -22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-04-08*210.00,22*2023-02-27*210.00," WHERE transferproductid = 5869;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '4', '44', '1', '5869', 'تحويل منتجات من المخزن', 'storemovementController.php', '44.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '96', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2078';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 634, 0, 0
                    , 210.00, 22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 634, 0, 0
                    , 210.00, 22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '7', '44', '0', '5869', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '52.00', '96', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '123', '8', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2940';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 4, 123, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 123, 0, 0
                    , 200.00, -6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2022-04-08*200.00,6*2023-02-27*200.00," WHERE transferproductid = 5870;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '4', '8', '1', '5870', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2079';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-08', 7, 123, 0, 0
                    , 200.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 123, 0, 0
                    , 200.00, 6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '7', '8', '0', '5870', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '17.00', '25', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '854', '5', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2909';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-05', 4, 854, 0, 0
                    , 195.00, 5, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2022-04-05*195.00," WHERE transferproductid = 5871;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('854', '4', '5', '1', '5871', 'تحويل منتجات من المخزن', 'storemovementController.php', '5.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2910';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-05', 7, 854, 0, 0
                    , 195.00, 5, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('854', '7', '5', '0', '5871', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '6', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '809', '8', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2907';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 809, 0, 0
                    , 110.00, -8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 110.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2023-02-27*110.00," WHERE transferproductid = 5872;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('809', '4', '8', '1', '5872', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '73', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2444';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 809, 0, 0
                    , 110.00, 8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('809', '7', '8', '0', '5872', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '65.00', '73', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '910', '2', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2906';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-04', 4, 910, 0, 0
                    , 165.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2022-04-04*165.00," WHERE transferproductid = 5873;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('910', '4', '2', '1', '5873', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2982';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-04', 7, 910, 0, 0
                    , 165.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('910', '7', '2', '0', '5873', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '647', '14', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2890';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-06', 4, 647, 0, 0
                    , 280.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2022-07-06*280.00," WHERE transferproductid = 5874;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '4', '14', '1', '5874', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '52', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2073';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-06', 7, 647, 0, 0
                    , 280.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '14', '0', '5874', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '38.00', '52', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '803', '1', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2870';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-02', 4, 803, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-04-02*145.00," WHERE transferproductid = 5875;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('803', '4', '1', '1', '5875', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2422';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-02', 7, 803, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('803', '7', '1', '0', '5875', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '1', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '805', '2', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2869';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-02', 4, 805, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 805, 0, 0
                    , 145.00, -1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-04-02*145.00,1*2023-02-27*145.00," WHERE transferproductid = 5876;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('805', '4', '2', '1', '5876', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2424';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-04-02', 7, 805, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 805, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('805', '7', '2', '0', '5876', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '26', '24', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2774';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 26, 0, 0
                    , 185.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 26, 0, 0
                    , 185.00, -1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-03-29*185.00,1*2023-02-27*185.00," WHERE transferproductid = 5877;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('26', '4', '24', '1', '5877', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1235';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 26, 0, 0
                    , 185.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 26, 0, 0
                    , 185.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('26', '7', '24', '0', '5877', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '27.00', '51', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '10', '11', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2773';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 10, 0, 0
                    , 155.00, -11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2023-02-27*155.00," WHERE transferproductid = 5878;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '4', '11', '1', '5878', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1220';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 10, 0, 0
                    , 155.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '7', '11', '0', '5878', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '11', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '426', '13', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2772';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 426, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 426, 0, 0
                    , 145.00, -12, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-03-29*145.00,12*2023-02-27*145.00," WHERE transferproductid = 5879;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '4', '13', '1', '5879', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3282';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 426, 0, 0
                    , 145.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 426, 0, 0
                    , 145.00, 12, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '7', '13', '0', '5879', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '13', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '431', '3', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2771';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 431, 0, 0
                    , 170.00, -3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2023-02-27*170.00," WHERE transferproductid = 5880;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '4', '3', '1', '5880', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2075';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 431, 0, 0
                    , 170.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '7', '3', '0', '5880', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '4', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '439', '23', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2770';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 439, 0, 0
                    , 170.00, 21, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-21, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 439, 0, 0
                    , 170.00, -2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-03-29*170.00,2*2023-02-27*170.00," WHERE transferproductid = 5881;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('439', '4', '23', '1', '5881', 'تحويل منتجات من المخزن', 'storemovementController.php', '23.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('439', '7', '23', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 439, 0, 0
                    , 170.00, 21, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 439, 0, 0
                    , 170.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('439', '7', '23', '0', '5881', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '96', '18', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2769';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 96, 0, 0
                    , 145.00, 12, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-12, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 96, 0, 0
                    , 145.00, -6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12*2022-03-29*145.00,6*2023-02-27*145.00," WHERE transferproductid = 5882;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '4', '18', '1', '5882', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('96', '7', '18', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 96, 0, 0
                    , 145.00, 12, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 96, 0, 0
                    , 145.00, 6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '7', '18', '0', '5882', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '422', '6', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2768';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 422, 0, 0
                    , 145.00, -6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2023-02-27*145.00," WHERE transferproductid = 5883;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '4', '6', '1', '5883', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3170';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 422, 0, 0
                    , 145.00, 6, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '7', '6', '0', '5883', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '11.00', '17', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '23', '19', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2767';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 23, 0, 0
                    , 185.00, 5, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 23, 0, 0
                    , 185.00, -14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2022-03-29*185.00,14*2023-02-27*185.00," WHERE transferproductid = 5884;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('23', '4', '19', '1', '5884', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1232';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 23, 0, 0
                    , 185.00, 5, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 23, 0, 0
                    , 185.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('23', '7', '19', '0', '5884', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '19', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '639', '30', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2766';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 639, 0, 0
                    , 125.00, 22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-22, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 639, 0, 0
                    , 125.00, -8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 125.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-03-29*125.00,8*2023-02-27*125.00," WHERE transferproductid = 5885;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '4', '30', '1', '5885', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2067';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 639, 0, 0
                    , 125.00, 22, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 639, 0, 0
                    , 125.00, 8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '7', '30', '0', '5885', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '32.00', '62', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '678', '25', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2765';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 678, 0, 0
                    , 145.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 678, 0, 0
                    , 145.00, -2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-03-29*145.00,2*2023-02-27*145.00," WHERE transferproductid = 5886;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '4', '25', '1', '5886', 'تحويل منتجات من المخزن', 'storemovementController.php', '25.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('678', '7', '25', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 678, 0, 0
                    , 145.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 678, 0, 0
                    , 145.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '7', '25', '0', '5886', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '25', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '664', '8', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2764';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 664, 0, 0
                    , 140.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 664, 0, 0
                    , 140.00, -7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2022-03-29*140.00,7*2023-02-27*140.00," WHERE transferproductid = 5887;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '4', '8', '1', '5887', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('664', '7', '8', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 664, 0, 0
                    , 140.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 664, 0, 0
                    , 140.00, 7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '7', '8', '0', '5887', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '8', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '635', '10', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2763';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 635, 0, 0
                    , 210.00, -10, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2023-02-27*210.00," WHERE transferproductid = 5888;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '4', '10', '1', '5888', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2077';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 635, 0, 0
                    , 210.00, 10, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '7', '10', '0', '5888', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '12.00', '22', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '781', '80', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2762';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 781, 0, 0
                    , 130.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-28', 4, 781, 0, 0
                    , 130.00, 36, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 781, 0, 0
                    , 130.00, -33, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 130.00,
                        buyQuantity =buyQuantity+-33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-03-29*130.00,36*2022-06-28*130.00,33*2023-02-27*130.00," WHERE transferproductid = 5889;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('781', '4', '80', '1', '5889', 'تحويل منتجات من المخزن', 'storemovementController.php', '80.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '84', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3079';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 781, 0, 0
                    , 130.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-28', 7, 781, 0, 0
                    , 130.00, 36, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 781, 0, 0
                    , 130.00, 33, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('781', '7', '80', '0', '5889', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '84', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '806', '14', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2761';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 806, 0, 0
                    , 145.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2022-03-29*145.00," WHERE transferproductid = 5890;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('806', '4', '14', '1', '5890', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('806', '7', '14', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 806, 0, 0
                    , 145.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('806', '7', '14', '0', '5890', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '14', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '792', '17', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2760';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 792, 0, 0
                    , 220.00, -17, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2023-02-27*220.00," WHERE transferproductid = 5891;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('792', '4', '17', '1', '5891', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('792', '7', '17', '1', '2023-02-27');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 792, 0, 0
                    , 220.00, 17, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('792', '7', '17', '0', '5891', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '17', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '747', '4', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2759';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 747, 0, 0
                    , 195.00, -4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*195.00," WHERE transferproductid = 5892;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '4', '4', '1', '5892', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2408';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 747, 0, 0
                    , 195.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '7', '4', '0', '5892', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '6', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '800', '17', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2758';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 800, 0, 0
                    , 180.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 800, 0, 0
                    , 180.00, -3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2022-03-29*180.00,3*2023-02-27*180.00," WHERE transferproductid = 5893;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('800', '4', '17', '1', '5893', 'تحويل منتجات من المخزن', 'storemovementController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2441';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 800, 0, 0
                    , 180.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 800, 0, 0
                    , 180.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('800', '7', '17', '0', '5893', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '16.00', '33', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '637', '27', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2757';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 637, 0, 0
                    , 185.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 637, 0, 0
                    , 185.00, -4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-03-29*185.00,4*2023-02-27*185.00," WHERE transferproductid = 5894;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '4', '27', '1', '5894', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2060';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 637, 0, 0
                    , 185.00, 23, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 637, 0, 0
                    , 185.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '7', '27', '0', '5894', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '36', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '739', '35', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2756';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 739, 0, 0
                    , 190.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 739, 0, 0
                    , 190.00, -32, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-03-29*190.00,32*2023-02-27*190.00," WHERE transferproductid = 5895;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '4', '35', '1', '5895', 'تحويل منتجات من المخزن', 'storemovementController.php', '35.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '49', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3080';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 739, 0, 0
                    , 190.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 739, 0, 0
                    , 190.00, 32, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '7', '35', '0', '5895', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '14.00', '49', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '853', '15', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2755';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 853, 0, 0
                    , 220.00, 8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-8, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 853, 0, 0
                    , 220.00, -7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2022-03-29*220.00,7*2023-02-27*220.00," WHERE transferproductid = 5896;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('853', '4', '15', '1', '5896', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2735';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 853, 0, 0
                    , 220.00, 8, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 853, 0, 0
                    , 220.00, 7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('853', '7', '15', '0', '5896', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '25', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '738', '47', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2754';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 738, 0, 0
                    , 190.00, 13, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-13, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 738, 0, 0
                    , 190.00, -34, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2022-03-29*190.00,34*2023-02-27*190.00," WHERE transferproductid = 5897;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '4', '47', '1', '5897', 'تحويل منتجات من المخزن', 'storemovementController.php', '47.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3081';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 738, 0, 0
                    , 190.00, 13, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 738, 0, 0
                    , 190.00, 34, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '7', '47', '0', '5897', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '70', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '75', '7', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2753';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 75, 0, 0
                    , 175.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-4, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 75, 0, 0
                    , 175.00, -3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2022-03-29*175.00,3*2023-02-27*175.00," WHERE transferproductid = 5898;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('75', '4', '7', '1', '5898', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1246';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 75, 0, 0
                    , 175.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 75, 0, 0
                    , 175.00, 3, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('75', '7', '7', '0', '5898', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '7', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '572', '13', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2752';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 572, 0, 0
                    , 210.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 572, 0, 0
                    , 210.00, -11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2022-03-29*210.00,11*2023-02-27*210.00," WHERE transferproductid = 5899;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '4', '13', '1', '5899', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2056';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 572, 0, 0
                    , 210.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 572, 0, 0
                    , 210.00, 11, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '7', '13', '0', '5899', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '33', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '852', '2', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2751';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 852, 0, 0
                    , 195.00, -2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2023-02-27*195.00," WHERE transferproductid = 5900;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('852', '4', '2', '1', '5900', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2734';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 852, 0, 0
                    , 195.00, 2, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('852', '7', '2', '0', '5900', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '645', '1', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2750';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 645, 0, 0
                    , 205.00, -1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-02-27*205.00," WHERE transferproductid = 5901;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '4', '1', '1', '5901', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2069';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 645, 0, 0
                    , 205.00, 1, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '7', '1', '0', '5901', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '2', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '807', '4', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2749';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 807, 0, 0
                    , 180.00, -4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4*2023-02-27*180.00," WHERE transferproductid = 5902;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('807', '4', '4', '1', '5902', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2443';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 807, 0, 0
                    , 180.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('807', '7', '4', '0', '5902', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '14', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '571', '18', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1765';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 571, 0, 0
                    , 210.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 571, 0, 0
                    , 210.00, -4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2022-03-29*210.00,4*2023-02-27*210.00," WHERE transferproductid = 5903;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '4', '18', '1', '5903', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1774';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 571, 0, 0
                    , 210.00, 14, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 571, 0, 0
                    , 210.00, 4, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '7', '18', '0', '5903', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '14.00', '32', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '298', '7', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '757';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 298, 0, 0
                    , 180.00, 7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-7, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "7*2021-11-08*180.00," WHERE transferproductid = 5904;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '4', '7', '1', '5904', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1796';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 298, 0, 0
                    , 180.00, 7, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '7', '7', '0', '5904', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '7', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '538', '27', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:13',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1677';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 4, 538, 0, 0
                    , 195.00, 26, 0, 0, 1, '2023-02-27 14:20:13')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-26, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:13' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 538, 0, 0
                    , 195.00, -1, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-03-29*195.00,1*2023-02-27*195.00," WHERE transferproductid = 5905;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('538', '4', '27', '1', '5905', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1674';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-03-29', 7, 538, 0, 0
                    , 195.00, 26, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 538, 0, 0
                    , 195.00, 1, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('538', '7', '27', '0', '5905', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '27', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '292', '3', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '751';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 292, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2021-11-08*160.00," WHERE transferproductid = 5906;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '4', '3', '1', '5906', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1802';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 292, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '7', '3', '0', '5906', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '283', '33', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '742';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 283, 0, 0
                    , 150.00, 13, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-13, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 4, 283, 0, 0
                    , 150.00, 20, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-20, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2021-11-08*150.00,20*2022-07-19*150.00," WHERE transferproductid = 5907;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '4', '33', '1', '5907', 'تحويل منتجات من المخزن', 'storemovementController.php', '33.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1811';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 283, 0, 0
                    , 150.00, 13, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 7, 283, 0, 0
                    , 150.00, 20, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '7', '33', '0', '5907', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '-6.00', '27', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '275', '18', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '734';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 275, 0, 0
                    , 205.00, 14, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 275, 0, 0
                    , 205.00, -4, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2021-11-08*205.00,4*2023-02-27*205.00," WHERE transferproductid = 5908;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '4', '18', '1', '5908', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1819';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 275, 0, 0
                    , 205.00, 14, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 275, 0, 0
                    , 205.00, 4, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '7', '18', '0', '5908', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '18', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '258', '19', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '717';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 258, 0, 0
                    , 190.00, 12, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-12, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 4, 258, 0, 0
                    , 190.00, 7, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-7, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12*2021-11-08*190.00,7*2022-07-21*190.00," WHERE transferproductid = 5909;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '4', '19', '1', '5909', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1835';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 258, 0, 0
                    , 190.00, 12, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-21', 7, 258, 0, 0
                    , 190.00, 7, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '7', '19', '0', '5909', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '19', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '231', '6', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '696';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 231, 0, 0
                    , 160.00, 6, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2021-11-08*160.00," WHERE transferproductid = 5910;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '4', '6', '1', '5910', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1856';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 231, 0, 0
                    , 160.00, 6, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '7', '6', '0', '5910', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '6', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '108', '3', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '679';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 108, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2021-11-08*160.00," WHERE transferproductid = 5911;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '4', '3', '1', '5911', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1874';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 108, 0, 0
                    , 160.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '7', '3', '0', '5911', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '3', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '90', '26', '2023-02-27', '1', '0','1276',null,null,'2023-02-27 14:20:14',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '678';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 4, 90, 0, 0
                    , 165.00, 23, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-23, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 4, 90, 0, 0
                    , 165.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2021-12-12*165.00,3*2022-07-19*165.00," WHERE transferproductid = 5912;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '4', '26', '1', '5912', 'تحويل منتجات من المخزن', 'storemovementController.php', '26.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1258';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 7, 90, 0, 0
                    , 165.00, 23, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-07-19', 7, 90, 0, 0
                    , 165.00, 3, 0, 0, 1, '2023-02-27 14:20:14')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:20:14' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '7', '26', '0', '5912', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '3.00', '29', '1', '2023-02-27','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:50:14";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:20:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:20:14', '1', 'editshow', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:50:26";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:20:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:20:26', '1', 'show', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:50:32";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:20:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:20:32', '1', 'editorder', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:50:36";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:20:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:20:36', '1', 'editorder', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:51:40";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:21:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 14:21:41', '1', '', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:51:47";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:21:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 14:21:47', '1', 'show', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:52:40";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:22:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:22:40', '1', '', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:45";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:23:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:23:45', '1', 'add', '156.210.80.14', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(1277,4,7,1011,13,'2023-02-27',1,0, '' ,0,0,0,0,0,'2023-02-27 14:23:45',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3810';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-15', 4, 1011, 0, 0
                    , 220.00, 13, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-13, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2022-06-15*220.00," WHERE transferproductid = 5913;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1011', '4', '13', '1', '5913', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3808';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-15', 7, 1011, 0, 0
                    , 220.00, 13, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1011', '7', '13', '0', '5913', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '7.00', '20', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1074', '14', '2023-02-27', '1', '0','1277',null,null,'2023-02-27 14:23:45',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3805';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-13', 4, 1074, 0, 0
                    , 220.00, 3, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1074, 0, 0
                    , 220.00, -11, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-08-13*220.00,11*2023-02-27*220.00," WHERE transferproductid = 5914;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1074', '4', '14', '1', '5914', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3806';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-08-13', 7, 1074, 0, 0
                    , 220.00, 3, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1074, 0, 0
                    , 220.00, 11, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1074', '7', '14', '0', '5914', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '32.00', '46', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1067', '5', '2023-02-27', '1', '0','1277',null,null,'2023-02-27 14:23:45',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3784';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-11', 4, 1067, 0, 0
                    , 325.00, 3, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1067, 0, 0
                    , 325.00, -2, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyprice = 325.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2022-06-11*325.00,2*2023-02-27*325.00," WHERE transferproductid = 5915;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1067', '4', '5', '1', '5915', 'تحويل منتجات من المخزن', 'storemovementController.php', '5.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3775';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-11', 7, 1067, 0, 0
                    , 325.00, 3, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1067, 0, 0
                    , 325.00, 2, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1067', '7', '5', '0', '5915', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '14', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '1069', '40', '2023-02-27', '1', '0','1277',null,null,'2023-02-27 14:23:45',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3755';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-10', 4, 1069, 0, 0
                    , 250.00, 39, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-39, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 1069, 0, 0
                    , 250.00, -1, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyprice = 250.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "39*2022-06-10*250.00,1*2023-02-27*250.00," WHERE transferproductid = 5916;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1069', '4', '40', '1', '5916', 'تحويل منتجات من المخزن', 'storemovementController.php', '40.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3777';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-06-10', 7, 1069, 0, 0
                    , 250.00, 39, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+39, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 1069, 0, 0
                    , 250.00, 1, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1069', '7', '40', '0', '5916', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '39.00', '79', '1', '2023-02-27','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '492', '6', '2023-02-27', '1', '0','1277',null,null,'2023-02-27 14:23:45',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2952';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 4, 492, 0, 0
                    , 180.00, -6, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2023-02-27*180.00," WHERE transferproductid = 5917;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('492', '4', '6', '1', '5917', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2023-02-27','0','0');
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2065';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-02-27', 7, 492, 0, 0
                    , 180.00, 6, 0, 0, 1, '2023-02-27 14:23:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2023-02-27 14:23:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('492', '7', '6', '0', '5917', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '29', '1', '2023-02-27','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:45";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:23:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2023-02-27 14:23:45', '1', 'editshow', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:50";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:23:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:23:50', '1', 'addsellBill', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:53";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:23:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 14:23:53', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:55";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:23:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:23:55', '1', 'addsellBill', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:53:57";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:23:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 14:23:57', '1', '', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:06";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:24:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:24:06', '1', 'showDetail', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:12";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:24:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 14:24:13', '4', 'add', '156.206.113.168', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'تروسيكل لشحن اسكندرية', '', '30', '2023-02-27', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '4360',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4390.00','30', '1', '7', 'إضافة مصروف', '2695', '4360', '2023-02-27 14:24:13', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '30', '30', '2023-02-27', '4', '0', '0', '2023-02-27 14:24:13','اضافة اسم مصروف( تروسيكل لشحن اسكندرية )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6336', '160', '30', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-1138980', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6336', '141', '30', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1097502', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'تروسيكل لشحن اسكندرية', expensesdetails = '', expensesValue = '30.00', expensesdate = '2023-02-27', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '6336', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2695';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:13";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:24:13", deviceType = "DESKTOP" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:13";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:24:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 14:24:13', '4', 'sucess', '156.206.113.168', '', 'DESKTOP');
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:24:13', '1', 'showDetail', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:14";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:24:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:24:14', '1', 'showDetail', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:15";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:24:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:24:15', '1', 'showDetail', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:24:15", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 14:24:15', '4', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:24:15", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 14:24:16', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:54:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:24:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:24:20', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:55:14";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:25:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:25:14', '1', 'addsellBill', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 10:55:22";
UPDATE user SET loginip = "156.210.80.14", lastactivetime = "2023-02-27 14:25:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:25:22', '1', 'addsellBill', '156.210.80.14', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 11:20:52";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:50:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:50:52', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 11:21:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 14:51:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 14:51:07', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:00:21";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:30:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 15:30:21', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:01:09";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:31:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 15:31:09', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:01:18";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:31:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 15:31:18', '4', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:02:12";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:32:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2023-02-27 15:32:12', '4', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:06:25";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:36:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 15:36:26', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:06:26";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:06:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:36:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 15:36:28', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:06:57";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:36:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 15:36:57', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:12:55";
UPDATE user SET loginip = "197.192.233.127", lastactivetime = "2023-02-27 15:42:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 15:42:55', '7', '', '197.192.233.127', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:12:55";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:13:01";
UPDATE user SET loginip = "197.192.233.127", lastactivetime = "2023-02-27 15:43:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 15:43:01', '7', '', '197.192.233.127', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:13:01";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE userid = 4;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:14:54";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:44:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 15:44:55', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:14:55";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:15:21";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-27 15:45:21', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:15:47";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:45:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 15:45:47', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:15:58";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:45:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 15:45:59', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:16:36";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:46:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2023-02-27 15:46:36', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:17:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:47:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2023-02-27 15:47:15', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:17:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:47:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-27 15:47:29', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:17:48";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:47:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-27 15:47:48', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE product SET productName = '467', productDescription = '', productCatId = '1', productBuyPrice = '155.00', productSellAllPrice = '165.00', productSellUnitPrice = '195.00', productSellHalfPrice = '175.00', productDate = '2021-11-07', conditions = '0', userId = '1', limitamount = '0', parcode = '00071',type ='0', expireDate = '0' , dailyentryId = '71',isService = '0',isOptic = '0',lastbuyprice = '155.00',lastbuyprice_withDiscount = '155',meanbuyprice = '155.00',meanbuyprice_withDiscount = '155' , productbuypricereal = '0.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '71';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (71, 1,'2023-02-27 15:48:20',1)
                ON DUPLICATE KEY UPDATE productid = 71, edited = 1, sysdate = '2023-02-27 15:48:20', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:18:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:48:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:48:29', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:21:34";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:51:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:51:36', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:21:37";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:51:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:51:37', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:21:46";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:51:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:51:46', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:22:18";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:52:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:52:18', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:22:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:52:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:52:20', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:22:22";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:52:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:52:22', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:23:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:53:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:53:32', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4506';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('792', '7', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:23:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:53:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:53:35', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:23:52";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:53:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 15:53:52', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:24:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:54:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 15:54:00', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:25:10";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:55:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2023-02-27 15:55:10', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:25:41";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:55:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2023-02-27 15:55:41', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:25:46";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:55:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2023-02-27 15:55:46', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:26:12";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:56:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:56:12', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:26:57";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:56:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:56:57', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1302';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '7', '40', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '40.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:26:59";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:56:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:56:59', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:27:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:57:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:57:14', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1301';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '7', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:27:16";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:57:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:57:17', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:27:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:57:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:57:35', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1299';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '7', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:27:37";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:57:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:57:37', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:01', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '7', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:03', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:40";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:40', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '7', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:42', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:53";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:53', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:28:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:58:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:58:55', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:09";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:09', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1292';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '7', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:11";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:11', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:27";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:27', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1293';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '7', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:29', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:55', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1294';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '7', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:29:57";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 15:59:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 15:59:57', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:30:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:00:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:00:20', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1295';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '7', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:30:22";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:00:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:00:22', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:30:54";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:00:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:00:54', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '7', '29', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '29.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:30:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:00:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:00:56', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:31:13";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:01:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:01:13', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:32:49";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:02:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 16:02:49', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:32:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:02:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 16:02:56', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:34:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:04:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-27 16:04:05', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:34:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:04:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-27 16:04:15', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:35:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:05:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 16:05:00', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:36:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:06:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:06:07', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:37:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:07:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:07:15', '1', 'tempdelete', '156.206.113.168', '', 'DESKTOP');
UPDATE client SET conditions = 1
		        WHERE clientid =117 ;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:37:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:07:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:07:15', '1', 'sucess', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:37:17";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:07:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:07:17', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:37:59";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:08:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:08:00', '1', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:38:06";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:08:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:08:06', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:38:27";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:08:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:08:27', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2070';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('666', '7', '31', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '56.00', '25', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:38:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:08:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:08:29', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:39:47";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:09:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:09:47', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3081';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '7', '40', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '70.00', '30', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:39:49";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:09:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:09:49', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:40:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:10:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:10:35', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('350', '7', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:40:37";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:10:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:10:37', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:40:56";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:10:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:10:56', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1844';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('244', '7', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '15', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:40:58";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:10:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:10:58', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:41:26";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:11:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:11:26', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('334', '7', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:41:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:11:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:11:28', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:42:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:12:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:12:28', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1693';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('264', '7', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '7', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:42:30";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:12:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:12:31', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:43:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:13:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:13:51', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:45:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:15:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:15:15', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2066';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('649', '7', '41', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '46.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:45:17";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:15:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:15:17', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:45:43";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:15:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:15:43', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2867';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '7', '21', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '2', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:45:45";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:15:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:15:45', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:46:08";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:16:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:16:08', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2056';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '7', '30', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '33.00', '3', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:46:10";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:16:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:16:10', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:47:02";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:17:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:17:02', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '7', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:47:04";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:17:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:17:04', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:47:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:17:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:17:51', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('227', '7', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:47:52";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:17:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:17:52', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:48:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:18:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:18:19', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1182', '7', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '25', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:48:21";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:18:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:18:21', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:48:39";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:18:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:18:39', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4361';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1183', '7', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '57.00', '40', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:48:41";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:18:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:18:41', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:19:14', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4243';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1160', '7', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '43.00', '30', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:16";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:19:16', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:19:31', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4303';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1171', '7', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '2', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:19:33', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:46";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:19:46', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:47";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:49:49";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:19:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:19:49', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:50:44";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:20:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:20:44', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:52:49";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:22:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:22:50', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:52:52";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:22:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:22:52', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:53:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:23:29", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:23:29', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:53:58";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:23:58", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:23:58', '4', 'addAndRetuen', '156.206.113.168', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fcbce147d8e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2023-02-27 16:23:29', '063fcbce147d8e', '1', '0.00', '0', '0', '1', '775', '775', '-775', '0', '7', '2023-02-27 16:23:58', '', '4', '0', 'نقدي','7', '0', '5', '0', 'نقدي', '5', '0', '', '','','','-1','0','0','0','','0','-775','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','3711', '0', '2023-02-27 16:23:58', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '775', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('150.00', '00281', '3711', '1', '281', '5', '155', '775', '0', '', '0', '0', '281', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where returnsellbilldetailid = 7865;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (281, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 775, 750, 750, 750
                    , 750, 750, 0, 0, 5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+775, returnSellCostBuyPrice = returnSellCostBuyPrice+750, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+750
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+750, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+750
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+750
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 775, 750, 750, 750
                    , 750, 750, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+775, returnSellCostBuyPrice = returnSellCostBuyPrice+750, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+750
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+750, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+750
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+750
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '-6', userid = '4', storedetaildate = '2023-02-27 16:23:58' WHERE storedetailid = '1813';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('281', '7', '5', '0', '3711', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '-11.00', '-6', '4', '2023-02-27 16:23:58','0','0');
UPDATE save SET  savecurrentvalue = '3585',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4360.00','775', '1', '7', 'اضافة فاتورة مردوات مبيعات', '3711', '3585', '2023-02-27 16:23:58', '4',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 775, 750, 750, 750
                    , 750, 750, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+775, returnSellCostBuyPrice = returnSellCostBuyPrice+750, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+750
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+750, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+750
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+750
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 775, 750, 750, 750
                    , 750, 750, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+775, returnSellCostBuyPrice = returnSellCostBuyPrice+750, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+750
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+750, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+750
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+750
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -775, -750, -750
                    , -750, -750, -750, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-775, netSellCostBuyPrice = netSellCostBuyPrice+-750
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-750
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-750
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-750
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-750
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fcbce147d8e and sellbillId = 3711 and returnsellbillId = 3711
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:53:59";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:23:59", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:23:59', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:28";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:24:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:24:28', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:35";
UPDATE user SET loginip = "197.192.233.127", lastactivetime = "2023-02-27 16:24:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:24:35', '7', '', '197.192.233.127', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:35";
UPDATE user SET loginip = "" WHERE userid = 4;
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:48";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:24:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:24:48', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:48";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:54:54";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:24:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:24:54', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:55:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:25:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:25:15', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4366';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1185', '7', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:55:17";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:25:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:25:17', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:55:46";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:25:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:25:46', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '52.00', '40', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:55:48";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:25:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:25:48', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:56:10";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:26:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:26:11', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4051';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1113', '7', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:56:12";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:26:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:26:13', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:56:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:26:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:26:31', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1037', '7', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:56:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:26:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:26:33', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:01";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:01', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4050';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1112', '7', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '43.00', '20', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:03', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:23";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:23', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3716';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1060', '7', '40', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '62.00', '22', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:24";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:27:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:27:24', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:24";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:25";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:25', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:45";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:27:45", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:27:45', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:45";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:45', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3642';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1041', '7', '21', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '33.00', '12', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:57:47";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:27:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:27:47', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:07', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1074', '7', '41', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '46.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:09";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:09', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:22";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:22', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3694';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1050', '7', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '21.00', '10', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:24', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:54";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:54', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4128';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1128', '7', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '32.00', '12', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:58:56";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:28:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:28:56', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:59:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:29:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:29:24', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('807', '7', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '10', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:59:26";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:29:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:29:26', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:59:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:29:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:29:42', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2072';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '7', '44', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '69.00', '25', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 12:59:44";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:29:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:29:44', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:30:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:30:19', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3218';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('967', '7', '29', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '54.00', '25', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:23";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:30:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 16:30:23', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:30:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:30:24', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:45";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:30:45", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 16:30:45', '7', 'add', '197.192.239.232', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =15714
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(31,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '270' , clientdate = '2023-02-27 16:30:46', userid = '7' WHERE clientid = '31';
UPDATE client SET  inUse = 0 where clientid = 31;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('31','970.00','700','1','ايصال تحصيل (( قبض من عميل ))','15714', '270', '2023-02-27 16:30:23', '7', 'clientPayedDeptController.php', '   ', '700', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '4650',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3950.00','700', '0', '5', 'ايصال تحصيل (( قبض من عميل ))', '15714', '4650', '2023-02-27 16:30:46', '7',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '700', '700', '2023-02-27', '7', '0', '0', '2023-02-27 16:30:46','اضافة ايصال سداد للعميل ام منه اسكوت','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6337', '139', '700', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-1467849', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6337', '84', '700', '','0');
UPDATE accountstree SET name = 'ام منه اسكوت', customName = 'ام منه اسكوت', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-10375', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '84';
UPDATE clientdebtchange SET clientid = '31', clientdebtchangebefore = '970.00', clientdebtchangeamount = '700.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '15714', clientdebtchangeafter = '270.00', clientdebtchangedate = '2023-02-27 16:30:23', userid = '7', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '700.00',discount='', reciptid=null, dailyentryid = '6337',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '15714';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add end - with modelid =15714 -clientdebtchangeId = 15714
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:46";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:30:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 16:30:46', '7', 'sucess', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:00:48";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:30:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 16:30:48', '7', 'show', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:01:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:31:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:31:20', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3947';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1104', '7', '52', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '112.00', '60', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:01:22";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:31:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:31:22', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:01:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:31:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:31:35', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1069', '7', '39', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '79.00', '40', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:01:37";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:31:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:31:37', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:01:58";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:31:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:31:58', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3469';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1012', '7', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '27.00', '12', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:32:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:32:00', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:07";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:32:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:32:07', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:37";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:32:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:32:37', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4049';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1114', '7', '37', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '57.00', '20', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:39";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:32:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:32:39', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:45";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:32:45", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:32:45', '7', 'addAndRetuen', '197.192.239.232', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fcbee770dd9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 16:32:07', '063fcbee770dd9', '1', '0.00', '0', '0', '1', '290', '290', '290', '0', '5', '2023-02-27 16:32:45', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','290','0','','0','0','290','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10397', '0', '2023-02-27 16:32:45', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '290', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10601;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('365','01157', '10397', '1', '1157', '1', '290.00', '290', '0', '', '0', '2023-02-27 16:32:45', '1157', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','10601-1,');
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 327.50, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 327.50
                where sellbilldetailid = 30309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1157, '2023-02-27', 290, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2023-02-27', 290, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '5', userid = '7', storedetaildate = '2023-02-27 16:32:45' WHERE storedetailid = '4220';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1157', '5', '1', '1', '10397', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6.00', '5', '7', '2023-02-27 16:32:45','0','0');
UPDATE save SET  savecurrentvalue = '4940',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4650.00','290', '0', '5', 'اضافة فاتورة مبيعات', '10397', '4940', '2023-02-27 16:32:45', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 290, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 290, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 290, 290, 365
                    , 327.5, 365, 327.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+290, netSellCostBuyPrice = netSellCostBuyPrice+290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+365
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+327.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+365
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+327.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fcbee770dd9 and sellbillId = 10397 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:46";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:32:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:32:46', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:54";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:32:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:32:54', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2409';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '7', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:02:56";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:32:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:32:56', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:03:07";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:33:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:33:07', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:03:13";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:33:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:33:13', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '2734';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('852', '7', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '1', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:03:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:33:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:33:15', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:03";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:34:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:34:03', '7', 'addAndRetuen', '197.192.239.232', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fcbf2372301
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2023-02-27 16:33:07', '063fcbf2372301', '1', '0.00', '0', '10', '1', '180', '170', '-170', '0', '5', '2023-02-27 16:34:03', '', '7', '0', 'نقدي','5', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-170','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','3712', '0', '2023-02-27 16:34:03', '7', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '170', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('150.00', '00125', '3712', '1', '125', '1', '180', '180', '0', '', '1', '0', '125', '0.00', '0','5','0','','','0','0','0','0','0','1');
UPDATE returnsellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 167.50, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 167.50
                where returnsellbilldetailid = 7866;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (125, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 190, 150, 185, 167.5
                    , 185, 167.5, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+190, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+167.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+167.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 190, 150, 185, 167.5
                    , 185, 167.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+190, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+167.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+167.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '7', storedetaildate = '2023-02-27 16:34:03' WHERE storedetailid = '914';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('125', '5', '1', '0', '3712', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '8.00', '9', '7', '2023-02-27 16:34:03','0','0');
UPDATE save SET  savecurrentvalue = '4770',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4940.00','170', '1', '5', 'اضافة فاتورة مردوات مبيعات', '3712', '4770', '2023-02-27 16:34:03', '7',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 150, 185, 167.5
                    , 185, 167.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+167.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+167.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 150, 185, 167.5
                    , 185, 167.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+167.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+167.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -170, -150, -185
                    , -167.5, -185, -167.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-170, netSellCostBuyPrice = netSellCostBuyPrice+-150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-185
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-167.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-185
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-167.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fcbf2372301 and sellbillId = 3712 and returnsellbillId = 3712
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:03";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:34:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:34:03', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:12";
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:12";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:34:12", deviceType = "DESKTOP" WHERE userid = 1;
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:34:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:34:12', '1', 'add', '156.206.113.168', '', 'DESKTOP');
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:34:12', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1068', '7', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '2', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:34:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:34:14', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:17";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:34:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:34:17', '1', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:25";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:34:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:34:25', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:25";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:26";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 16:34:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:34:26', '7', 'showDetail', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:04:30";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:34:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:34:30', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 4;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:05:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:35:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:35:14', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:05:14";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:05:19";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:35:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:35:19', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:05:49";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:35:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:35:49', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4456';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('128', '7', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:05:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:35:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:35:51', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:06:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:36:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:36:03', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('963', '7', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:06:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:36:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:36:05', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:06:40";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:36:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:36:40', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3173';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('964', '7', '34', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '84.00', '50', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:06:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:36:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:36:42', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:07:01";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:37:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:37:02', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3172';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('959', '7', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '20', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:07:04";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:37:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:37:04', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:07:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:37:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 16:37:07', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:07:25";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:37:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:37:26', '1', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:07:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:37:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:37:33', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:08:24";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:38:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:38:24', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1125', '7', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '21.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:08:26";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:38:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:38:26', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:08:45";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:38:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:38:45', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1122', '7', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '5', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:08:47";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:38:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:38:47', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:14";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:39:14', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1226';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '7', '38', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '38.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:16";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:39:16', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:39:29', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '1227';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('18', '7', '51', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '51.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:39:31', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:34";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:39:34', '1', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:43";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:39:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:39:43', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:09:43";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:11:11";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:41:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:41:11', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:11:12";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:11:15";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:41:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 16:41:15', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:12:04";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:42:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:42:05', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:12:05";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:12:09";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:42:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 16:42:09', '1', 'edit', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:12:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:42:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:42:55', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:12:55";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:13:20";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:43:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:43:20', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:13:21";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:13:23";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:43:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:43:23', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 4;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:13:55";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:43:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:43:55', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:13:55";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:14:17";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:44:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:44:17', '1', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:15:08";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:45:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:45:08', '1', '', '156.206.113.168', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:15:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:45:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:45:42', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:15:42";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:15:45";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:45:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:45:45', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:16:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:46:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:46:31', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('799', '7', '158', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '158.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:16:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:46:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:46:33', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:05', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4060';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('620', '7', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:07', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:32";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:32', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '7', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:33";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:34', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:51', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4493';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('626', '7', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:17:53";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:47:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:47:53', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:06";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:48:07', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '4055';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('631', '7', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:08";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:48:08', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:18";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:48:18', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 4;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:27";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:48:27', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:27";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:48:30', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:58";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:48:58', '1', 'add', '156.206.113.168', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2023-02-27' WHERE storedetailid = '3995';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('627', '7', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2023-02-27','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:18:59";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:48:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2023-02-27 16:48:59', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:19:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:49:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:49:03', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:20:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:50:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:50:00', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:20:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:50:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:50:29', '1', 'deleteFinaly', '156.206.113.168', '', 'DESKTOP');
UPDATE accountstree SET name = 'جلال ابو حلا', customName = 'جلال ابو حلا', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '1', userid = '4', mydate = '2022-03-17', itemtype2 = '1', theValue = '-7200.00', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '213';
DELETE FROM tamweenclientdetail WHERE clientid = '137';
DELETE FROM client WHERE clientid = '137';
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:20:30";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:50:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2023-02-27 16:50:30', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:21:00";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:51:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 16:51:00', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:21:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:51:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2023-02-27 16:51:07', '1', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:22:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:52:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:52:03', '1', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:22:29";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:52:29", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 16:52:29', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:22:29";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:22:31";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:52:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:52:31', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:22:51";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:52:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 16:52:51', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:02";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:02", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 16:53:02', '4', 'add', '156.206.113.168', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'اكياس', '', '45', '2023-02-27', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '3540',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3585.00','45', '1', '7', 'إضافة مصروف', '2696', '3540', '2023-02-27 16:53:03', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '45', '45', '2023-02-27', '4', '0', '0', '2023-02-27 16:53:03','اضافة اسم مصروف( اكياس )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6338', '160', '45', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-1139025', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6338', '141', '45', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1097547', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'اكياس', expensesdetails = '', expensesValue = '45.00', expensesdate = '2023-02-27', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '6338', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2696';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:03";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 16:53:03', '4', 'sucess', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 16:53:05', '4', 'show', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:05";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:53:05', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:23";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:53:23', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:35";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:53:35', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:23:56";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:53:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:53:56', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:26:40";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:56:40", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:56:40', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:26:59";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:56:59", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:56:59', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:27:07";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:57:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:57:07', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:28:06";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:58:06", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:58:06', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:28:11";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:58:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 16:58:12', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:28:18";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 16:58:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 16:58:18', '4', '', '156.206.113.168', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:42:40";
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:43:10";
UPDATE user SET loginip = "156.210.78.229", lastactivetime = "2023-02-27 17:13:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 17:13:10', '1', '', '156.210.78.229', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:43:10";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:43:36";
UPDATE user SET loginip = "156.210.78.229", lastactivetime = "2023-02-27 17:13:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 17:13:37', '1', '', '156.210.78.229', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:46:42";
UPDATE user SET loginip = "156.206.113.168", lastactivetime = "2023-02-27 17:16:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 17:16:42', '4', 'addsellBill', '156.206.113.168', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:52:16";
UPDATE user SET loginip = "156.210.55.222", lastactivetime = "2023-02-27 17:22:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 17:22:16', '1', '', '156.210.55.222', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:52:16";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:52:21";
UPDATE user SET loginip = "156.210.55.222", lastactivetime = "2023-02-27 17:22:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 17:22:21', '1', '', '156.210.55.222', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 13:52:29";
UPDATE user SET loginip = "156.210.55.222", lastactivetime = "2023-02-27 17:22:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 17:22:30', '1', 'addsellBill', '156.210.55.222', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 14:33:10";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 18:03:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 18:03:11', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 14:33:12";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 14:33:14";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 18:03:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 18:03:16', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 14:33:17";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 18:03:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 18:03:18', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:10:57";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 18:40:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 18:40:57', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:39:49";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:09:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 19:09:49', '1', 'addsellBill', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:43:05";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 19:13:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 19:13:05', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:50:25";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:20:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:20:26', '1', 'edit', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:50:51";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:20:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:20:51', '1', 'update', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET username = 'admin', password = '0123', usergroupid = '1', employeename = 'admin', currentdate = '2021-11-07', conditions = '0', saveid = '1'  , userstoreid ='0' ,awardrate = '0.00' ,searchinonesave = '0', branchId = '0', question = 'لا اله الا الله', answer = 'محمد رسول الله',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='1',empid='0',obygyDoctorId = '0'  WHERE userid = '1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:50:56";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:20:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:20:56', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:50:57";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:20:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:20:58', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:59:15";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:29:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 19:29:16', '1', '', '156.210.40.23', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 15:59:16";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:03:25";
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:03:25";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:04:09";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:34:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 19:34:09', '1', '', '156.210.40.23', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:04:30";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:34:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 19:34:30', '1', 'add', '156.210.40.23', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =15717
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(13,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '0' , clientdate = '2023-02-27 19:34:30', userid = '1' WHERE clientid = '13';
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('13','2000.00','2000','1','ايصال تحصيل (( قبض من عميل ))','15717', '0', '2023-02-27 19:34:09', '1', 'clientPayedDeptController.php', '   ', '2000', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '2000',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('0.00','2000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '15717', '2000', '2023-02-27 19:34:30', '1',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '1', '0', '0', '2023-02-27 19:34:30','اضافة ايصال سداد للعميل سنتر المجد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6339', '54', '2000', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '-139696', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6339', '66', '2000', '','0');
UPDATE accountstree SET name = 'سنتر المجد', customName = 'سنتر المجد', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-67855', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '66';
UPDATE clientdebtchange SET clientid = '13', clientdebtchangebefore = '2000.00', clientdebtchangeamount = '2000.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '15717', clientdebtchangeafter = '0.00', clientdebtchangedate = '2023-02-27 19:34:09', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2000.00',discount='', reciptid=null, dailyentryid = '6339',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '15717';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add end - with modelid =15717 -clientdebtchangeId = 15717
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:04:31";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:34:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 19:34:31', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:04:32";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:34:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 19:34:32', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:04:50";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:34:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:34:50', '1', '', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:04";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:04', '1', 'add', '156.210.40.23', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('7','9', '3540.00', '2023-02-27', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '0',  userid = '1' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3540.00','3540.00', '1', '7', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '456', '0', '2023-02-27 19:35:04', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '5342775',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5339235.00','3540.00', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل العميد ] ', '456', '5342775', '2023-02-27 19:35:04', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3540', '3540', '2023-02-27', '1', '0', '0', '2023-02-27 19:35:04','اضافة تحويل من خزينة محل العميد الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6340', '156', '3540.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5342775', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6340', '141', '3540.00', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1101087', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE transfermoney SET saveidfrom = '7', saveidto = '9', transfermoneyvalue = '3540.00', transfermoneydate = '2023-02-27', userid = '1', conditions = '0' , dailyentryid = '6340' , comment = '' WHERE transfermoneyid = '456';
COMMIT;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:08";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:08', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:10";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:10', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:18";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:18', '1', '', '156.210.40.23', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:33";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:33', '1', 'add', '156.210.40.23', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('1','9', '2000.00', '2023-02-27', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '0',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2000.00','2000.00', '1', '1', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '457', '0', '2023-02-27 19:35:33', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '5344775',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5342775.00','2000.00', '0', '9', 'تحويل امول من الخزنة  [ الخزنة الرئيسية ] ', '457', '5344775', '2023-02-27 19:35:33', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '1', '0', '0', '2023-02-27 19:35:33','اضافة تحويل من الخزنة الرئيسية الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6341', '156', '2000.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5344775', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6341', '54', '2000.00', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '-141696', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
UPDATE transfermoney SET saveidfrom = '1', saveidto = '9', transfermoneyvalue = '2000.00', transfermoneydate = '2023-02-27', userid = '1', conditions = '0' , dailyentryid = '6341' , comment = '' WHERE transfermoneyid = '457';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:35";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:35', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:37";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:37', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:55";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:55', '1', 'delete', '156.210.40.23', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','1', '2000.00', '2023-02-27', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '5342775',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5344775.00','2000.00', '1', '9', 'تحويل امول الى الخزنة  [ الخزنة الرئيسية ] ', '458', '5342775', '2023-02-27 19:35:55', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '2000',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('0.00','2000.00', '0', '1', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '458', '2000', '2023-02-27 19:35:55', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '1', '0', '0', '2023-02-27 19:35:55','اضافة تحويل من الشيخ وليد الى الخزنة الرئيسية','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6342', '54', '2000.00', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '-139696', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6342', '156', '2000.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5342775', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '1', transfermoneyvalue = '2000.00', transfermoneydate = '2023-02-27', userid = '1', conditions = '2' , dailyentryid = '6342' , comment = '' WHERE transfermoneyid = '458';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:05:59";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:35:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:35:59', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:01";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:36:01', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:08";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:36:08', '1', 'delete', '156.210.40.23', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','1', '2000.00', '2023-02-27', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '5340775',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5342775.00','2000.00', '1', '9', 'تحويل امول الى الخزنة  [ الخزنة الرئيسية ] ', '459', '5340775', '2023-02-27 19:36:08', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '4000',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2000.00','2000.00', '0', '1', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '459', '4000', '2023-02-27 19:36:08', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '1', '0', '0', '2023-02-27 19:36:08','اضافة تحويل من الشيخ وليد الى الخزنة الرئيسية','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6343', '54', '2000.00', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '-137696', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6343', '156', '2000.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5340775', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '1', transfermoneyvalue = '2000.00', transfermoneydate = '2023-02-27', userid = '1', conditions = '2' , dailyentryid = '6343' , comment = '' WHERE transfermoneyid = '459';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:11";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:36:11', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:13";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:36:13', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:20";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 19:36:20', '1', '', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:27";
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:28";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:37";
UPDATE user SET loginip = "196.159.155.118", lastactivetime = "2023-02-27 19:36:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 19:36:37', '4', '', '196.159.155.118', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:37";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE notics SET productno = '191', productnotsellno = '1120', kempilano = '0', clientcheckno = '0', suppliercheckno = '0' WHERE noticesid = '1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:43";
UPDATE user SET loginip = "196.159.155.118", lastactivetime = "2023-02-27 19:36:43", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:36:43', '4', 'edit', '196.159.155.118', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:43";
UPDATE user SET loginip = "196.159.155.118", lastactivetime = "2023-02-27 19:36:43", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:36:43', '4', 'edit', '196.159.155.118', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:44";
UPDATE user SET loginip = "196.159.155.118", lastactivetime = "2023-02-27 19:36:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:36:44', '4', 'edit', '196.159.155.118', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:06:59";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:36:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:36:59', '1', '', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:14";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:14', '1', 'add', '156.210.40.23', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('1','9', '4000.00', '2023-02-27', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '0',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4000.00','4000.00', '1', '1', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '460', '0', '2023-02-27 19:37:14', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '5344775',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5340775.00','4000.00', '0', '9', 'تحويل امول من الخزنة  [ الخزنة الرئيسية ] ', '460', '5344775', '2023-02-27 19:37:14', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4000', '4000', '2023-02-27', '1', '0', '0', '2023-02-27 19:37:14','اضافة تحويل من الخزنة الرئيسية الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6344', '156', '4000.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5344775', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6344', '54', '4000.00', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '-141696', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
UPDATE transfermoney SET saveidfrom = '1', saveidto = '9', transfermoneyvalue = '4000.00', transfermoneydate = '2023-02-27', userid = '1', conditions = '0' , dailyentryid = '6344' , comment = '' WHERE transfermoneyid = '460';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:18";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:18', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:20";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:20', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:28";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:28', '1', 'show', '156.210.40.23', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:38";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:38', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:07:50";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:37:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:37:50', '1', 'show', '156.210.40.23', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:08:44";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:38:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-27 19:38:44', '1', '', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:08:49";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:38:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 19:38:49', '1', 'addsellBill', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:09:33";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:39:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:39:34', '1', 'edit', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:09:44";
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:09:45";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:39:45", deviceType = "DESKTOP" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:09:45";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:39:45', '1', 'show', '156.210.40.23', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:18:24";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:48:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:48:24', '1', 'edit', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:18:32";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:48:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:48:32', '1', 'update', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET username = 'admin', password = '3636', usergroupid = '1', employeename = 'admin', currentdate = '2021-11-07', conditions = '0', saveid = '1'  , userstoreid ='0' ,awardrate = '0.00' ,searchinonesave = '0', branchId = '0', question = 'لا اله الا الله', answer = 'محمد رسول الله',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='1',empid='0',obygyDoctorId = '0'  WHERE userid = '1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:18:34";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:48:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:48:34', '1', 'sucess', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:18:36";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:48:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2023-02-27 19:48:36', '1', 'show', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:18:41";
UPDATE user SET loginip = "156.210.40.23", lastactivetime = "2023-02-27 19:48:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 19:48:41', '1', 'addsellBill', '156.210.40.23', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:36:20";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 20:06:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 20:06:20', '7', 'addAndRetuen', '197.192.239.232', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fce4a22028c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 19:13:06', '063fce4a22028c', '1', '0.00', '0', '15', '1', '195', '180', '180', '0', '5', '2023-02-27 20:06:20', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','180','0','','0','0','180','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10398', '0', '2023-02-27 20:06:20', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '180', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 9458;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('240','00466', '10398', '1', '466', '1', '195.00', '195', '0', '', '2', '2023-02-27 20:06:20', '466', '0.00', '0', '5','0','','','0','0','0','0','0','0','2','0','','9458-1,');
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 191.88, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 191.88
                where sellbilldetailid = 30310;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (466, '2023-02-27', 180, 175, 240
                    , 191.88, 240, 191.88, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+191.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+191.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2023-02-27', 180, 175, 240
                    , 191.88, 240, 191.88, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+191.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+191.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '47', userid = '7', storedetaildate = '2023-02-27 20:06:20' WHERE storedetailid = '4165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '5', '1', '1', '10398', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48.00', '47', '7', '2023-02-27 20:06:20','0','0');
UPDATE save SET  savecurrentvalue = '4950',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4770.00','180', '0', '5', 'اضافة فاتورة مبيعات', '10398', '4950', '2023-02-27 20:06:20', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 180, 175, 240
                    , 191.88, 240, 191.88, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+191.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+191.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 180, 175, 240
                    , 191.88, 240, 191.88, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+191.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+191.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 180, 175, 240
                    , 191.88, 240, 191.88, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+180, netSellCostBuyPrice = netSellCostBuyPrice+175
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+240
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+191.88
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+240
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+191.88
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fce4a22028c and sellbillId = 10398 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 16:36:20";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 20:06:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 20:06:20', '7', 'addsellBill', '197.192.239.232', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 17:30:05";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:00:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 21:00:05', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 17:30:06";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 17:30:07";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:00:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:00:08', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:07";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-27 21:34:07', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:07";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:14";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:34:15', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:38";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:34:38', '5', 'addAndRetuen', '154.180.143.12', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fd05b72a313
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 21:34:15', '063fd05b72a313', '1', '0.00', '0', '0', '1', '165', '165', '165', '0', '3', '2023-02-27 21:34:39', '', '5', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','165','0','','0','0','165','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '5' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10399', '0', '2023-02-27 21:34:39', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '165', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1710;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('145','00304', '10399', '1', '304', '1', '165', '165', '0', '', '0', '2023-02-27 21:34:39', '304', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','1710-1,');
UPDATE sellbilldetail SET  lastbuyprice = 145.00 , meanbuyprice = 145.00, lastbuyprice_withDiscount = 145.00, meanbuyprice_withDiscount = 145.00
                where sellbilldetailid = 30311;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (304, '2023-02-27', 165, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (3, '2023-02-27', 165, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '5', storedetaildate = '2023-02-27 21:34:39' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('304', '3', '1', '1', '10399', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14.00', '13', '5', '2023-02-27 21:34:39','0','0');
UPDATE save SET  savecurrentvalue = '450',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('285.00','165', '0', '3', 'اضافة فاتورة مبيعات', '10399', '450', '2023-02-27 21:34:39', '5',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 165, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 165, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 165, 145, 145
                    , 145, 145, 145, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+165, netSellCostBuyPrice = netSellCostBuyPrice+145
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+145
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+145
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+145
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+145
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fd05b72a313 and sellbillId = 10399 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:39";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:34:39', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:46";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:34:46', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:04:52";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:34:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:34:52', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:02";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:36:02', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:32";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:36:32', '5', 'addAndRetuen', '154.180.143.12', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063fd062300770
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-27 21:36:03', '063fd062300770', '1', '0.00', '0', '0', '1', '715', '715', '715', '0', '3', '2023-02-27 21:36:32', '', '5', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','715','0','','0','0','715','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '5' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10400', '0', '2023-02-27 21:36:32', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '715', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10595;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('365','01154', '10400', '1', '1154', '1', '370.00', '370', '0', '', '0', '2023-02-27 21:36:32', '1154', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','10595-1,');
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
                where sellbilldetailid = 30312;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1154, '2023-02-27', 370, 365, 365
                    , 365, 365, 365, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+370, sellCostBuyPrice =sellCostBuyPrice+365
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+365
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+365
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (3, '2023-02-27', 370, 365, 365
                    , 365, 365, 365, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+370, sellCostBuyPrice =sellCostBuyPrice+365
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+365
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+365
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '5', storedetaildate = '2023-02-27 21:36:32' WHERE storedetailid = '4225';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1154', '3', '1', '1', '10400', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1.00', '0', '5', '2023-02-27 21:36:32','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('345','01180', '10400', '1', '1180', '1', '345.00', '345', '0', '', '0', '2023-02-27 21:36:32', '1180', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 345.00 , meanbuyprice = 345.00, lastbuyprice_withDiscount = 345.00, meanbuyprice_withDiscount = 345.00
                where sellbilldetailid = 30313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1180, '2023-02-27', 345, 345, 345
                    , 345, 345, 345, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+345, sellCostBuyPrice =sellCostBuyPrice+345
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+345, sellCostMeanBuyPrice = sellCostMeanBuyPrice+345
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+345, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+345
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (3, '2023-02-27', 345, 345, 345
                    , 345, 345, 345, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+345, sellCostBuyPrice =sellCostBuyPrice+345
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+345, sellCostMeanBuyPrice = sellCostMeanBuyPrice+345
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+345, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+345
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '5', storedetaildate = '2023-02-27 21:36:32' WHERE storedetailid = '4340';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1180', '3', '1', '1', '10400', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2.00', '1', '5', '2023-02-27 21:36:32','0','0');
UPDATE save SET  savecurrentvalue = '1165',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('450.00','715', '0', '3', 'اضافة فاتورة مبيعات', '10400', '1165', '2023-02-27 21:36:32', '5',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-27', 715, 710, 710
                    , 710, 710, 710, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+715, sellCostBuyPrice =sellCostBuyPrice+710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+710, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-27', 715, 710, 710
                    , 710, 710, 710, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+715, sellCostBuyPrice =sellCostBuyPrice+710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+710, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 715, 710, 710
                    , 710, 710, 710, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+715, netSellCostBuyPrice = netSellCostBuyPrice+710
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+710
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+710
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+710
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+710
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063fd062300770 and sellbillId = 10400 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:32";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:36:32', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:34";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 21:36:34', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:57";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 21:36:57', '5', 'add', '154.180.143.12', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =15721
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(69,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '27610' , clientdate = '2023-02-27 21:36:57', userid = '5' WHERE clientid = '69';
UPDATE client SET  inUse = 0 where clientid = 69;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('69','29610.00','2000','1','ايصال تحصيل (( قبض من عميل ))','15721', '27610', '2023-02-27 21:36:34', '5', 'clientPayedDeptController.php', '   ', '2000', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '3165',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1165.00','2000', '0', '3', 'ايصال تحصيل (( قبض من عميل ))', '15721', '3165', '2023-02-27 21:36:57', '5',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '5', '0', '0', '2023-02-27 21:36:57','اضافة ايصال سداد للعميل سنتر مكه','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6345', '137', '2000', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-843575', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '137';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6345', '122', '2000', '','0');
UPDATE accountstree SET name = 'سنتر مكه', customName = 'سنتر مكه', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-121910', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '122';
UPDATE clientdebtchange SET clientid = '69', clientdebtchangebefore = '29610.00', clientdebtchangeamount = '2000.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '15721', clientdebtchangeafter = '27610.00', clientdebtchangedate = '2023-02-27 21:36:34', userid = '5', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2000.00',discount='', reciptid=null, dailyentryid = '6345',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '15721';
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add end - with modelid =15721 -clientdebtchangeId = 15721
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:06:57";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:36:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 21:36:58', '5', 'sucess', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:07:04";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:37:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2023-02-27 21:37:04', '5', 'show', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:08:20";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:38:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:38:20', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:20:54";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:50:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:50:54', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:22:12";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:52:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:52:12', '5', 'showDetail', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:23:34";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:53:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-27 21:53:34', '5', 'addsellBill', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:26:03";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:56:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:56:03', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:26:06";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:56:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:56:07', '5', 'showDetail', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:31";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 21:59:31', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:45";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 21:59:45', '5', 'add', '154.180.143.12', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'مرتب موفق', '', '2000', '2023-02-27', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '1165',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3165.00','2000', '1', '3', 'إضافة مصروف', '2697', '1165', '2023-02-27 21:59:45', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2000', '2000', '2023-02-27', '5', '0', '0', '2023-02-27 21:59:45','اضافة اسم مصروف( مرتب موفق )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6346', '160', '2000', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-1141025', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6346', '137', '2000', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-845575', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '137';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'مرتب موفق', expensesdetails = '', expensesValue = '2000.00', expensesdate = '2023-02-27', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '6346', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2697';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:45";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 21:59:45', '5', 'sucess', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:46";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 21:59:47', '5', 'show', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:48";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:59:48', '5', '', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 18:29:56";
UPDATE user SET loginip = "154.180.143.12", lastactivetime = "2023-02-27 21:59:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 21:59:56', '5', 'showDetail', '154.180.143.12', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:11:28";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:41:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 22:41:28', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:11:48";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:41:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 22:41:48', '7', 'showDetail', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:24:54";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:54:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 22:54:54', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:25:49";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:55:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 22:55:49', '7', 'add', '197.192.239.232', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'عمادحمدي', '', '150', '2023-02-27', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '4800',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4950.00','150', '1', '5', 'إضافة مصروف', '2698', '4800', '2023-02-27 22:55:49', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '150', '150', '2023-02-27', '7', '0', '0', '2023-02-27 22:55:49','اضافة اسم مصروف( عمادحمدي )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6347', '145', '150', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '341940', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6347', '139', '150', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-1467999', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'عمادحمدي', expensesdetails = '', expensesValue = '150.00', expensesdate = '2023-02-27', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '6347', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2698';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:25:51";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:55:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 22:55:51', '7', 'sucess', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:25:52";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:55:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-27 22:55:52', '7', 'show', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:26:22";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:56:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 22:56:22', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:26:26";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 22:56:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 22:56:26', '7', 'showDetail', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:27";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2023-02-27 23:19:27', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:27";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:27', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:27";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:28', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:28";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:28', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:28";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:28', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:28";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:28', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:29";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:29', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:49:29";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:19:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:19:29', '7', '', '197.192.239.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-27 19:52:51";
UPDATE user SET loginip = "197.192.239.232", lastactivetime = "2023-02-27 23:22:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-27 23:22:51', '7', 'showDetail', '197.192.239.232', '', 'DESKTOP');
