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 < "2021-12-20 06:43:13";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:13:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 10:13:14', '4', '', '197.61.49.205', '', '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 = '1', 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 = '2021-12-20',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 < "2021-12-20 06:43: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 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;
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 < "2021-12-20 06:44:26";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:14:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 10:14:26', '6', '', '197.61.49.205', '', '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 < "2021-12-20 06:44: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 < "2021-12-20 06:44:28";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:14:28", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:14:28', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 06:46:20";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:16:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:16:20', '6', 'addAndRetuen', '197.61.49.205', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c03b6504843
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 10:14:29', '061c03b6504843', '1', '0.00', '0', '0', '1', '705', '705', '705', '0', '4', '2021-12-20 10:16:20', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','705','0','','0','0','705','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مبيعات','380', '0', '2021-12-20 10:16:20', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '705', '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','00589', '380', '1', '589', '2', '235.00', '470', '0', '', '0', '2021-12-20 10:16:20', '589', '0.00', '0', '4','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 = 798;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (589, '2021-12-20', 470, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, 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 (4, '2021-12-20', 470, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, 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 = '1', userid = '6', storedetaildate = '2021-12-20 10:16:20' WHERE storedetailid = '1574';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('589', '4', '2', '1', '380', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3.00', '1', '6', '2021-12-20 10:16:20','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2220;
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','00590', '380', '1', '590', '1', '235', '235', '0', '', '0', '2021-12-20 10:16:20', '590', '0.00', '0', '4','0','','','0','0','0','0','0','0','0','0','','2220-1,');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 799;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (590, '2021-12-20', 235, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, 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 (4, '2021-12-20', 235, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, 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 = '0', userid = '6', storedetaildate = '2021-12-20 10:16:20' WHERE storedetailid = '1669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '4', '1', '1', '380', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1.00', '0', '6', '2021-12-20 10:16:20','0','0');
UPDATE save SET  savecurrentvalue = '705',  userid = '6' WHERE saveid = '4';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('0.00','705', '0', '4', 'اضافة فاتورة مبيعات', '380', '705', '2021-12-20 10:16:20', '6',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 705, 690, 690
                    , 690, 690, 690, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+690
                            , 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, '2021-12-20', 705, 690, 690
                    , 690, 690, 690, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+690
                            , 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, 705, 690, 690
                    , 690, 690, 690, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+705, netSellCostBuyPrice = netSellCostBuyPrice+690
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+690
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+690
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+690
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+690
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c03b6504843 and sellbillId = 380 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 06:46:20";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:16:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:16:20', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 06:46:25";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:16:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:16:25', '6', 'addsellBill', '197.61.49.205', '', '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 < "2021-12-20 06:57:52";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:27:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 10:27:52', '6', '', '197.61.49.205', '', '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 < "2021-12-20 06:57:52";
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 < "2021-12-20 06:57:55";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:27:55", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 10:27:55', '6', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 06:59:27";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:29:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 10:29:27', '6', 'showDetail', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 6;
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 < "2021-12-20 07:00:08";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:30:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 10:30:08', '4', '', '197.61.49.205', '', '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 < "2021-12-20 07:00:08";
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 < "2021-12-20 07:00:41";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:30:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:30:41', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:05";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:05', '4', 'addAndRetuen', '197.61.49.205', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c03f319ad16
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 10:30:41', '061c03f319ad16', '1', '0.00', '0', '0', '1', '485', '485', '-485', '0', '7', '2021-12-20 10:31:05', '', '4', '0', 'نقدي','7', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-485','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','اضافة فاتورة مردوات مبيعات','114', '0', '2021-12-20 10:31:05', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '485', '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 ('210.00', '00563', '114', '1', '563', '1', '220.00', '220', '0', '', '0', '0', '563', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where returnsellbilldetailid = 180;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (563, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 220, 210, 210, 210
                    , 210, 210, 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+220, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , 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, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 220, 210, 210, 210
                    , 210, 210, 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+220, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '6', userid = '4', storedetaildate = '2021-12-20 10:31:05' WHERE storedetailid = '1553';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '7', '1', '0', '114', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '5.00', '6', '4', '2021-12-20 10:31:05','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 ('255.00', '00566', '114', '1', '566', '1', '265', '265', '0', '', '0', '0', '566', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
                where returnsellbilldetailid = 181;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (566, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 265, 255, 255, 255
                    , 255, 255, 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+265, returnSellCostBuyPrice = returnSellCostBuyPrice+255, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+255
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+255, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+255
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+255
                            , 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, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 265, 255, 255, 255
                    , 255, 255, 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+265, returnSellCostBuyPrice = returnSellCostBuyPrice+255, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+255
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+255, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+255
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+255
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '4', storedetaildate = '2021-12-20 10:31:05' WHERE storedetailid = '1524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('566', '7', '1', '0', '114', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '12.00', '13', '4', '2021-12-20 10:31:05','0','0');
UPDATE save SET  savecurrentvalue = '-485',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('0.00','485', '1', '7', 'اضافة فاتورة مردوات مبيعات', '114', '-485', '2021-12-20 10:31:05', '4',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 485, 465, 465, 465
                    , 465, 465, 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+485, returnSellCostBuyPrice = returnSellCostBuyPrice+465, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+465
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+465, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+465
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+465
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 485, 465, 465, 465
                    , 465, 465, 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+485, returnSellCostBuyPrice = returnSellCostBuyPrice+465, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+465
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+465, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+465
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+465
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -485, -465, -465
                    , -465, -465, -465, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-485, netSellCostBuyPrice = netSellCostBuyPrice+-465
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-465
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-465
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-465
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-465
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c03f319ad16 and sellbillId = 114 and returnsellbillId = 114
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:05";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:05", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:05', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:12";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:12', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:19";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 10:31:19', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:26";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:26', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:52";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:52', '4', 'addAndRetuen', '197.61.49.205', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c03f5ec5924
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 10:31:26', '061c03f5ec5924', '1', '0.00', '0', '0', '1', '705', '705', '705', '0', '7', '2021-12-20 10:31:52', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','705','0','','0','0','705','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','اضافة فاتورة مبيعات','381', '0', '2021-12-20 10:31:52', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '705', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 2260;
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','00589', '381', '1', '589', '2', '235.00', '470', '0', '', '0', '2021-12-20 10:31:52', '589', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2260-2,');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 800;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (589, '2021-12-20', 470, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, 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, '2021-12-20', 470, 460, 460
                    , 460, 460, 460, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, 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 = '1', userid = '4', storedetaildate = '2021-12-20 10:31:52' WHERE storedetailid = '1573';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('589', '7', '2', '1', '381', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3.00', '1', '4', '2021-12-20 10:31:52','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2224;
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','00590', '381', '1', '590', '1', '235', '235', '0', '', '0', '2021-12-20 10:31:52', '590', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2224-1,');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 801;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (590, '2021-12-20', 235, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, 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, '2021-12-20', 235, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, 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 = '2021-12-20 10:31:52' WHERE storedetailid = '1670';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '7', '1', '1', '381', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.00', '6', '4', '2021-12-20 10:31:52','0','0');
UPDATE save SET  savecurrentvalue = '220',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('-485.00','705', '0', '7', 'اضافة فاتورة مبيعات', '381', '220', '2021-12-20 10:31:52', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 705, 690, 690
                    , 690, 690, 690, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+690
                            , 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, '2021-12-20', 705, 690, 690
                    , 690, 690, 690, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+690
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+690, sellCostMeanBuyPrice = sellCostMeanBuyPrice+690
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+690, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+690
                            , 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, 705, 690, 690
                    , 690, 690, 690, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+705, netSellCostBuyPrice = netSellCostBuyPrice+690
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+690
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+690
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+690
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+690
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c03f5ec5924 and sellbillId = 381 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:53";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:31:53', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:01:57";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:31:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 10:31:57', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:02:03";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:32:03", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:32:03', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:12:40";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:42:40", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 10:42:40', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:12:42";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 10:42:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 10:42:42', '4', 'addsellBill', '197.61.49.205', '', '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 < "2021-12-20 07:41:17";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:11:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 11:11:25', '1', '', '197.56.140.213', '', '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 < "2021-12-20 07:41: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 < "2021-12-20 07:41:33";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:11:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2021-12-20 11:11:33', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:41:46";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:11:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2021-12-20 11:11:46', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:42:17";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:12:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2021-12-20 11:12:17', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:46:54";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:16:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2021-12-20 11:16:54', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:48:14";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:18:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2021-12-20 11:18:14', '1', 'add', '197.56.140.213', '', '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 =668
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(13,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '19790' , clientdate = '2021-12-20 11:18:14', 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','27090.00','7300','1','ايصال تحصيل (( قبض من عميل ))','668', '19790', '2021-12-20 11:16:54', '1', 'clientPayedDeptController.php', 'قمة مرتجعات عبايات', '7300', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '128076',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('120776.00','7300', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '668', '128076', '2021-12-20 11:18:14', '1',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '7300', '7300', '2021-12-20', '1', '0', '0', '2021-12-20 11:18:14','اضافة ايصال سداد للعميل سنتر المجد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('906', '54', '7300', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '133185', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('906', '66', '7300', '','0');
UPDATE accountstree SET name = 'سنتر المجد', customName = 'سنتر المجد', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-13780', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '66';
UPDATE clientdebtchange SET clientid = '13', clientdebtchangebefore = '27090.00', clientdebtchangeamount = '7300.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '668', clientdebtchangeafter = '19790.00', clientdebtchangedate = '2021-12-20 11:16:54', userid = '1', tablename = 'clientPayedDeptController.php', comment = 'قمة مرتجعات عبايات', totalOperationCost = '7300.00',discount='', reciptid=null, dailyentryid = '906',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '668';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:48:15";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:18:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2021-12-20 11:18:15', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:48:17";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:18:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2021-12-20 11:18:17', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:52:51";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:22:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('returnsellbillController.php', '2021-12-20 11:22:52', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:53:00";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:23:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('returnsellbillController.php', '2021-12-20 11:23:00', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:53:25";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:23:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('returnsellbillController.php', '2021-12-20 11:23:25', '1', 'show', '197.56.140.213', '', '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 < "2021-12-20 07:54:13";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:24:13", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 11:24:13', '6', '', '197.61.49.205', '', '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 < "2021-12-20 07:54:13";
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 < "2021-12-20 07:54:15";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:24:15", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:24:15', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:54:22";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:24:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:24:22', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:54:52";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:24:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:24:52', '6', 'addAndRetuen', '197.61.49.205', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c04bbff0d14
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 11:24:15', '061c04bbff0d14', '1', '0.00', '0', '0', '1', '705', '705', '-705', '0', '4', '2021-12-20 11:24:52', '', '6', '0', 'نقدي','4', '0', '5', '0', 'نقدي', '3', '0', '', '','','','-1','0','0','0','','0','-705','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '6' 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','اضافة فاتورة مردوات مبيعات','115', '0', '2021-12-20 11:24:52', '6', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '705', '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 ('230.00', '00589', '115', '1', '589', '2', '235.00', '470', '0', '', '0', '0', '589', '0.00', '0','4','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where returnsellbilldetailid = 182;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (589, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 470, 460, 460, 460
                    , 460, 460, 0, 0, 2)
                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+470, returnSellCostBuyPrice = returnSellCostBuyPrice+460, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+460
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+460, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+460
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+460
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (4, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 470, 460, 460, 460
                    , 460, 460, 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+470, returnSellCostBuyPrice = returnSellCostBuyPrice+460, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+460
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+460, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+460
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+460
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '3', userid = '6', storedetaildate = '2021-12-20 11:24:52' WHERE storedetailid = '1574';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('589', '4', '2', '0', '115', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1.00', '3', '6', '2021-12-20 11:24:52','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 ('230.00', '00590', '115', '1', '590', '1', '235', '235', '0', '', '0', '0', '590', '0.00', '0','4','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where returnsellbilldetailid = 183;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (590, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 235, 230, 230, 230
                    , 230, 230, 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+235, returnSellCostBuyPrice = returnSellCostBuyPrice+230, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+230
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+230, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+230
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+230
                            , 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 (4, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 235, 230, 230, 230
                    , 230, 230, 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+235, returnSellCostBuyPrice = returnSellCostBuyPrice+230, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+230
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+230, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+230
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+230
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '6', storedetaildate = '2021-12-20 11:24:52' WHERE storedetailid = '1669';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '4', '1', '0', '115', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0.00', '1', '6', '2021-12-20 11:24:52','0','0');
UPDATE save SET  savecurrentvalue = '0',  userid = '6' WHERE saveid = '4';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('705.00','705', '1', '4', 'اضافة فاتورة مردوات مبيعات', '115', '0', '2021-12-20 11:24:52', '6',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 705, 690, 690, 690
                    , 690, 690, 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+705, returnSellCostBuyPrice = returnSellCostBuyPrice+690, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+690
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+690, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+690
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+690
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-12-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 705, 690, 690, 690
                    , 690, 690, 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+705, returnSellCostBuyPrice = returnSellCostBuyPrice+690, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+690
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+690, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+690
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+690
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -705, -690, -690
                    , -690, -690, -690, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-705, netSellCostBuyPrice = netSellCostBuyPrice+-690
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-690
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-690
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-690
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-690
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c04bbff0d14 and sellbillId = 115 and returnsellbillId = 115
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:54:52";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:24:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:24:53', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:54:58";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:24:59", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 11:24:59', '6', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:55:04";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:25:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:25:04', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:56:53";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:26:53", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:26:53', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:56:56";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:26:56", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 11:26:56', '6', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:56:59";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:26:59", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:26:59', '6', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 07:57:00";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:27:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2021-12-20 11:27:00', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:02:30";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:32:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:32:30', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:02:53";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:32:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:32:53', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:06:26";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:36:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:36:26', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '4', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '7.00', '9', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:06:28";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:36:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:36:28', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:07:10";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:37:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:37:10', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '3.00', '4', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:07:12";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:37:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:37:12', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:07:53";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:37:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:37:53', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1511';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '42.00', '43', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:07:55";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:37:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:37:55', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:08:18";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:38:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:38:18', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '766';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '32.00', '33', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:08:20";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:38:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:38:20', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:09:48";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:39:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:39:48', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '769';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '4', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '15', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:09:50";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:39:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:39:50', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:11:08";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:41:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:41:08', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:11:22";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:41:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:41:24', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:11:53";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:41:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:41:53', '1', 'add', '197.56.140.213', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('416','','1','165','175', '205','185', '2021-12-20', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','6.06','12.12','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '416', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '175', productSellUnitPrice = '205', productSellHalfPrice = '185', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00611',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '611';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '611', '1', '2021-12-20', '1', '0','0061101','175','185','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('611', '1', '0', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '1', '0', '0', '611', 'إضافة منتج', 'productController.php', '0', '0', '1', '2021-12-20','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (611, 1,'2021-12-20 11:41:53',1)
                ON DUPLICATE KEY UPDATE productid = 611, edited = 1, sysdate = '2021-12-20 11:41:53', userid = 1;
UPDATE product SET productName = '416', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '175.00', productSellUnitPrice = '205.00', productSellHalfPrice = '185.00', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00611',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '611';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:11:55";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:41:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:41:55', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:12:04";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:42:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:42:04', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:12:06";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:42:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:42:06', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:12:26";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:42:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:42:26', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:12:27";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:42:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:42:28', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:12:44";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:42:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:42:44', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:01";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:43:01', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1756';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:03";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:43:03', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:03";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:43:03', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:18";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:43:18', '1', 'add', '197.56.140.213', '', '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(187,1,4,611,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:43:18',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1756';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 611, 0, 0
                    , 165.00, -1, 0, 0, 1, '2021-12-20 11:43:18')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:43:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00," WHERE transferproductid = 1249;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '1', '1', '1', '1249', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('611', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 611, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 11:43:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:43:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '4', '1', '0', '1249', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:19";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:43:19', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:20";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:43:21', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:36";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:43:36', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1757';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '4', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1.00', '7', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:38";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:43:38', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:13:56";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:43:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:43:56', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:23";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:44:23', '1', 'add', '197.56.140.213', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('424','','1','165','175', '205','185', '2021-12-20', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','6.06','12.12','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '424', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '175', productSellUnitPrice = '205', productSellHalfPrice = '185', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00612',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '612';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '612', '1', '2021-12-20', '1', '0','0061201','175','185','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('612', '1', '1', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '1', '1', '0', '612', 'إضافة منتج', 'productController.php', '0', '1', '1', '2021-12-20','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (612, 1,'2021-12-20 11:44:24',1)
                ON DUPLICATE KEY UPDATE productid = 612, edited = 1, sysdate = '2021-12-20 11:44:24', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '165', '165', '2021-12-20', '1', '0', '0', '2021-12-20 11:44:24','إضافة منتج 424 الكمية 1','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('907', '19', '165', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6151971.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('907', '7', '165', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7003587.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = '424', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '175.00', productSellUnitPrice = '205.00', productSellHalfPrice = '185.00', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00612',type ='0', expireDate = '0' , dailyentryId = '907',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '612';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:25";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:44:25', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:26";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:44:26', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:39";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:44:39', '1', 'add', '197.56.140.213', '', '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(188,1,4,612,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:44:39',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1758';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 612, 0, 0
                    , 165.00, -1, 0, 0, 1, '2021-12-20 11:44:39')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:44:39' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00," WHERE transferproductid = 1250;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '1', '1', '1', '1250', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('612', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 612, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 11:44:39')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:44:39' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '4', '1', '0', '1250', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:40";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:44:40', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:14:41";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:44:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:44:42', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:04";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:45:04', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1759';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '1.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:06";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:45:06', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:21";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:45:21', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:49";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:45:49', '1', 'add', '197.56.140.213', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('429','','1','165','175', '205','185', '2021-12-20', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','6.06','12.12','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '429', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '175', productSellUnitPrice = '205', productSellHalfPrice = '185', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '613';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '613', '1', '2021-12-20', '1', '0','0061301','175','185','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('613', '1', '1', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '1', '1', '0', '613', 'إضافة منتج', 'productController.php', '0', '1', '1', '2021-12-20','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (613, 1,'2021-12-20 11:45:49',1)
                ON DUPLICATE KEY UPDATE productid = 613, edited = 1, sysdate = '2021-12-20 11:45:49', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '165', '165', '2021-12-20', '1', '0', '0', '2021-12-20 11:45:49','إضافة منتج 429 الكمية 1','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('908', '19', '165', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6152136.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('908', '7', '165', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7003752.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = '429', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '175.00', productSellUnitPrice = '205.00', productSellHalfPrice = '185.00', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00613',type ='0', expireDate = '0' , dailyentryId = '908',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '613';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:51";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:45:51', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:15:51";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:45:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:45:52', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:09";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:46:09', '1', 'add', '197.56.140.213', '', '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(189,1,4,613,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:46:09',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1760';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 613, 0, 0
                    , 165.00, -1, 0, 0, 1, '2021-12-20 11:46:09')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:46:09' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00," WHERE transferproductid = 1251;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '1', '1', '1', '1251', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('613', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 613, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 11:46:09')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:46:09' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '4', '1', '0', '1251', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:10";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:46:10', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:12";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:46:12', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:28";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:46:28', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1761';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '4', '4', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1.00', '5', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:30";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:46:30', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:16:54";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:46:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:46:54', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:19";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:47:19', '1', 'add', '197.56.140.213', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('417','','1','165','175', '205','185', '2021-12-20', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','6.06','12.12','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '417', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '175', productSellUnitPrice = '205', productSellHalfPrice = '185', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '614';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '614', '1', '2021-12-20', '1', '0','0061401','175','185','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('614', '1', '1', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '1', '1', '0', '614', 'إضافة منتج', 'productController.php', '0', '1', '1', '2021-12-20','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (614, 1,'2021-12-20 11:47:19',1)
                ON DUPLICATE KEY UPDATE productid = 614, edited = 1, sysdate = '2021-12-20 11:47:19', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '165', '165', '2021-12-20', '1', '0', '0', '2021-12-20 11:47:19','إضافة منتج 417 الكمية 1','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('909', '19', '165', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6152301.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('909', '7', '165', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7003917.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = '417', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '175.00', productSellUnitPrice = '205.00', productSellHalfPrice = '185.00', productDate = '2021-12-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00614',type ='0', expireDate = '0' , dailyentryId = '909',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '6.06' , buyhalf_precentage = '12.12' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '614';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:21";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 11:47:21', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:24";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:47:24', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:34";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:47:35', '1', 'add', '197.56.140.213', '', '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(190,1,4,614,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:47:35',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1762';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 614, 0, 0
                    , 165.00, -1, 0, 0, 1, '2021-12-20 11:47:35')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:47:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00," WHERE transferproductid = 1252;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '1', '1', '1', '1252', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('614', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 614, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 11:47:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:47:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '4', '1', '0', '1252', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:35";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:47:35', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:37";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:47:37', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:46";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:47:46', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1763';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '1.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:17:48";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:47:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:47:48', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 6;
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 < "2021-12-20 08:18:11";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:48:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 11:48:11', '4', '', '197.61.49.205', '', '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 < "2021-12-20 08:18:11";
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 < "2021-12-20 08:18:14";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:48:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:48:14', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:18:34";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:48:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:48:34', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:18:57";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:48:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:48:57', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1557';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:18:59";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:48:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:48:59', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:01";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:49:01', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:14";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:49:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:49:14', '4', 'addAndRetuen', '197.61.49.205', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c0515e8851d
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 11:48:14', '061c0515e8851d', '1', '0.00', '0', '0', '1', '210', '210', '210', '0', '7', '2021-12-20 11:49:15', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','210','0','','0','0','210','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','اضافة فاتورة مبيعات','382', '0', '2021-12-20 11:49:15', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '210', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1498;
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','00516', '382', '1', '516', '1', '210', '210', '0', '', '0', '2021-12-20 11:49:15', '516', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1498-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 802;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (516, '2021-12-20', 210, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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, '2021-12-20', 210, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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 = '6', userid = '4', storedetaildate = '2021-12-20 11:49:15' WHERE storedetailid = '1300';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '7', '1', '1', '382', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.00', '6', '4', '2021-12-20 11:49:15','0','0');
UPDATE save SET  savecurrentvalue = '430',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('220.00','210', '0', '7', 'اضافة فاتورة مبيعات', '382', '430', '2021-12-20 11:49:15', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 210, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-12-20', 210, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 210, 220, 220
                    , 220, 220, 220, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+210, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c0515e8851d and sellbillId = 382 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:15";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:49:15", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:49:15', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:16";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:49:16', '1', 'add', '197.56.140.213', '', '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(191,1,4,586,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:49:16',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1557';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 586, 0, 0
                    , 155.00, -1, 0, 0, 1, '2021-12-20 11:49:16')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:49:16' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*155.00," WHERE transferproductid = 1253;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '1', '1', '1', '1253', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('586', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 586, 0, 0
                    , 155.00, 1, 0, 0, 1, '2021-12-20 11:49:16')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:49:16' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '4', '1', '0', '1253', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:16";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:49:16', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:18";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:49:18', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:20";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:49:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 11:49:20', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:33";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 11:49:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 11:49:33', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:35";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:49:35', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1764';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '4', '3', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1.00', '4', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:19:37";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:49:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:49:38', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:20:02";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:50:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:50:02', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '23.00', '24', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:20:04";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:50:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:50:04', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:20:24";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:50:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:50:24', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:02";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:51:02', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '290', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '289.00', '290', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:03";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:51:04', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:04";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:51:04', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:21";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:51:21', '1', 'add', '197.56.140.213', '', '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(192,1,4,571,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:51:21',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '289', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1530';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 571, 0, 0
                    , 210.00, -1, 0, 0, 1, '2021-12-20 11:51:21')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:51:21' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*210.00," WHERE transferproductid = 1254;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '1', '1', '1254', 'تحويل منتجات من المخزن', 'storemovementController.php', '290.00', '289', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('571', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 571, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 11:51:21')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:51:21' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '4', '1', '0', '1254', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:22";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:51:22', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:23";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:51:24', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:34";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:51:34', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1765';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '4', '26', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1.00', '27', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:21:36";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:51:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:51:36', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:22:59";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:52:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:52:59', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '725';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('266', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:23:01";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:53:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:53:01', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:23:39";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:53:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:53:40', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '726';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:23:41";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:53:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:53:41', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:24:22";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:54:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:54:22', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '724';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('265', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:24:24";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:54:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:54:24', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:25:31";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:55:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:55:31', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '772';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '4', '10', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '8.00', '18', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:25:33";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:55:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:55:33', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:25:54";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:55:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:55:55', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:12";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:56:12', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:14";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:56:14', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:24";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:56:25', '1', 'add', '197.56.140.213', '', '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(193,1,4,251,1,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 11:56:25',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '251';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 1, 251, 0, 0
                    , 210.00, -1, 0, 0, 1, '2021-12-20 11:56:25')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:56:25' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*210.00," WHERE transferproductid = 1255;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '1255', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('251', '4', '1', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 251, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 11:56:25')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 11:56:25' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '4', '1', '0', '1255', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:25";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:56:25', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:27";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:56:27', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:34";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:56:34', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1766';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1.00', '2', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:26:36";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:56:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:56:36', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:27:04";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:57:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 11:57:04', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:27:14";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 11:57:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 11:57:14', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:33:41";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:03:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 12:03:41', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:34:44";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:04:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 12:04:44', '1', 'addAllStoreProducts', '197.56.140.213', '', '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;
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('4', '7', '614', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1763';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 614, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-12-20*165.00," WHERE transferproductid = 1256;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '4', '1.00', '1', '1256', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('614', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 614, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('614', '7', '1.00', '0', '1256', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '613', '5.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1761';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 613, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 613, 0, 0
                    , 165.00, -4, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00,4*2021-12-20*165.00," WHERE transferproductid = 1257;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '4', '5.00', '1', '1257', 'تحويل منتجات من المخزن', 'storemovementController.php', '5.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('613', '7', '5.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 613, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 613, 0, 0
                    , 165.00, 4, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('613', '7', '5.00', '0', '1257', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '5.00', '1', '2021-12-20','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', '612', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1759';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 612, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-12-20*165.00," WHERE transferproductid = 1258;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '4', '1.00', '1', '1258', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('612', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 612, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('612', '7', '1.00', '0', '1258', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '611', '7.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1757';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 611, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 611, 0, 0
                    , 165.00, -6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*165.00,6*2021-12-20*165.00," WHERE transferproductid = 1259;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '4', '7.00', '1', '1259', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('611', '7', '7.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 611, 0, 0
                    , 165.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 611, 0, 0
                    , 165.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '7', '7.00', '0', '1259', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '7.00', '1', '2021-12-20','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', '610', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1755';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-19', 4, 610, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-12-19*165.00," WHERE transferproductid = 1260;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('610', '4', '1.00', '1', '1260', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('610', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-19', 7, 610, 0, 0
                    , 165.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('610', '7', '1.00', '0', '1260', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '590', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1669';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 590, 0, 0
                    , 230.00, -1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 230.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-12-20*230.00," WHERE transferproductid = 1261;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '4', '1.00', '1', '1261', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1670';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 590, 0, 0
                    , 230.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '7', '1.00', '0', '1261', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '7', '1', '2021-12-20','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', '589', '3.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1574';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 589, 0, 0
                    , 230.00, -3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 230.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3.00*2021-12-20*230.00," WHERE transferproductid = 1262;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('589', '4', '3.00', '1', '1262', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1573';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 589, 0, 0
                    , 230.00, 3.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('589', '7', '3.00', '0', '1262', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '4', '1', '2021-12-20','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', '587', '18.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1566';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 587, 0, 0
                    , 170.00, 18.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-18.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18.00*2021-11-30*170.00," WHERE transferproductid = 1263;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '4', '18.00', '1', '1263', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('587', '7', '18.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 587, 0, 0
                    , 170.00, 18.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '7', '18.00', '0', '1263', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18.00', '1', '2021-12-20','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', '586', '4.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1764';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 586, 0, 0
                    , 155.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 586, 0, 0
                    , 155.00, -3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*155.00,3*2021-12-20*155.00," WHERE transferproductid = 1264;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '4', '4.00', '1', '1264', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('586', '7', '4.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 586, 0, 0
                    , 155.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 586, 0, 0
                    , 155.00, 3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '7', '4.00', '0', '1264', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '4.00', '1', '2021-12-20','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', '585', '13.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1560';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-01', 4, 585, 0, 0
                    , 220.00, 11, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 585, 0, 0
                    , 220.00, -2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2021-12-01*220.00,2*2021-12-20*220.00," WHERE transferproductid = 1265;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '4', '13.00', '1', '1265', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1555';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-01', 7, 585, 0, 0
                    , 220.00, 11, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 585, 0, 0
                    , 220.00, 2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '7', '13.00', '0', '1265', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '30.00', '43', '1', '2021-12-20','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', '27.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1765';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 571, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 571, 0, 0
                    , 210.00, -26, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*210.00,26*2021-12-20*210.00," WHERE transferproductid = 1266;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '4', '27.00', '1', '1266', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('571', '7', '27.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 571, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 571, 0, 0
                    , 210.00, 26, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '7', '27.00', '0', '1266', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27.00', '1', '2021-12-20','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', '565', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1509';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1267;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '4', '0.00', '1', '1267', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1514';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '7', '0.00', '0', '1267', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '1', '1', '2021-12-20','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', '563', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1485';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1268;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '4', '0.00', '1', '1268', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1553';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '7', '0.00', '0', '1268', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '6', '1', '2021-12-20','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', '562', '30.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1508';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 4, 562, 0, 0
                    , 225.00, 30.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-30.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30.00*2021-11-18*225.00," WHERE transferproductid = 1269;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '4', '30.00', '1', '1269', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1513';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 7, 562, 0, 0
                    , 225.00, 30.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '7', '30.00', '0', '1269', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '34', '1', '2021-12-20','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', '561', '2.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1510';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 4, 561, 0, 0
                    , 210.00, 2.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2.00*2021-11-18*210.00," WHERE transferproductid = 1270;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '4', '2.00', '1', '1270', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1515';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 7, 561, 0, 0
                    , 210.00, 2.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '7', '2.00', '0', '1270', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '25', '1', '2021-12-20','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', '556', '12.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1475';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-14', 4, 556, 0, 0
                    , 195.00, 12.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-12.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12.00*2021-11-14*195.00," WHERE transferproductid = 1271;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '4', '12.00', '1', '1271', 'تحويل منتجات من المخزن', 'storemovementController.php', '12.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1473';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-14', 7, 556, 0, 0
                    , 195.00, 12.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '7', '12.00', '0', '1271', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '12', '1', '2021-12-20','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', '555', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1476';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1272;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '4', '0.00', '1', '1272', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1474';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '7', '0.00', '0', '1272', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '62.00', '62', '1', '2021-12-20','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.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1677';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 4, 538, 0, 0
                    , 195.00, 27.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-27.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27.00*2021-12-12*195.00," WHERE transferproductid = 1273;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('538', '4', '27.00', '1', '1273', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1674';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 7, 538, 0, 0
                    , 195.00, 27.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('538', '7', '27.00', '0', '1273', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '27.00', '54', '1', '2021-12-20','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', '537', '18.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1678';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 4, 537, 0, 0
                    , 195.00, 18.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-18.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18.00*2021-12-12*195.00," WHERE transferproductid = 1274;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('537', '4', '18.00', '1', '1274', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1673';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 7, 537, 0, 0
                    , 195.00, 18.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('537', '7', '18.00', '0', '1274', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '18.00', '36', '1', '2021-12-20','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', '536', '29.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1681';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 4, 536, 0, 0
                    , 195.00, 29.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-29.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29.00*2021-12-12*195.00," WHERE transferproductid = 1275;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('536', '4', '29.00', '1', '1275', 'تحويل منتجات من المخزن', 'storemovementController.php', '29.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '59', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1679';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 7, 536, 0, 0
                    , 195.00, 29.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('536', '7', '29.00', '0', '1275', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '30.00', '59', '1', '2021-12-20','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', '518', '7.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '792';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 518, 0, 0
                    , 210.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 518, 0, 0
                    , 210.00, -1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2021-11-08*210.00,1*2021-12-20*210.00," WHERE transferproductid = 1276;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '4', '7.00', '1', '1276', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1302';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 518, 0, 0
                    , 210.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 518, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '7', '7.00', '0', '1276', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '24.00', '31', '1', '2021-12-20','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', '517', '14.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '791';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 517, 0, 0
                    , 210.00, 14.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14.00*2021-11-08*210.00," WHERE transferproductid = 1277;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '4', '14.00', '1', '1277', 'تحويل منتجات من المخزن', 'storemovementController.php', '14.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1301';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 517, 0, 0
                    , 210.00, 14.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '7', '14.00', '0', '1277', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '12.00', '26', '1', '2021-12-20','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', '516', '4.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '790';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 516, 0, 0
                    , 220.00, 4.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-4.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "4.00*2021-11-08*220.00," WHERE transferproductid = 1278;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '4', '4.00', '1', '1278', 'تحويل منتجات من المخزن', 'storemovementController.php', '4.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1300';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 516, 0, 0
                    , 220.00, 4.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '7', '4.00', '0', '1278', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '10', '1', '2021-12-20','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', '515', '13.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '789';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-15', 4, 515, 0, 0
                    , 220.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 515, 0, 0
                    , 220.00, -7, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2021-12-15*220.00,7*2021-12-20*220.00," WHERE transferproductid = 1279;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '4', '13.00', '1', '1279', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1299';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-15', 7, 515, 0, 0
                    , 220.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 515, 0, 0
                    , 220.00, 7, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '7', '13.00', '0', '1279', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '26.00', '39', '1', '2021-12-20','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', '514', '19.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '788';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 514, 0, 0
                    , 210.00, 19.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-19.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "19.00*2021-11-08*210.00," WHERE transferproductid = 1280;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '4', '19.00', '1', '1280', 'تحويل منتجات من المخزن', 'storemovementController.php', '19.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1298';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 514, 0, 0
                    , 210.00, 19.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+19.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '7', '19.00', '0', '1280', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '34', '1', '2021-12-20','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', '513', '10.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '787';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 513, 0, 0
                    , 210.00, 10.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10.00*2021-11-08*210.00," WHERE transferproductid = 1281;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '4', '10.00', '1', '1281', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1297';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 513, 0, 0
                    , 210.00, 10.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '7', '10.00', '0', '1281', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '7.00', '17', '1', '2021-12-20','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', '511', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '786';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1282;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('511', '4', '0.00', '1', '1282', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('511', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('511', '7', '0.00', '0', '1282', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '474', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '785';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1283;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('474', '4', '0.00', '1', '1283', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('474', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('474', '7', '0.00', '0', '1283', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '465', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1512';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 4, 465, 0, 0
                    , 210.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-11-18*210.00," WHERE transferproductid = 1284;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '4', '1.00', '1', '1284', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1467';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 7, 465, 0, 0
                    , 210.00, 1.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '7', '1.00', '0', '1284', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '17.00', '18', '1', '2021-12-20','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', '463', '43.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1511';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 4, 463, 0, 0
                    , 190.00, 26, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-26, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 463, 0, 0
                    , 190.00, -17, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2021-11-18*190.00,17*2021-12-20*190.00," WHERE transferproductid = 1285;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '4', '43.00', '1', '1285', 'تحويل منتجات من المخزن', 'storemovementController.php', '43.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '67', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1516';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-18', 7, 463, 0, 0
                    , 190.00, 26, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 463, 0, 0
                    , 190.00, 17, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '7', '43.00', '0', '1285', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '24.00', '67', '1', '2021-12-20','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', '461', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '784';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1286;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('461', '4', '0.00', '1', '1286', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('461', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('461', '7', '0.00', '0', '1286', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '458', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '782';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1287;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('458', '4', '0.00', '1', '1287', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('458', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('458', '7', '0.00', '0', '1287', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '455', '9.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1563';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 455, 0, 0
                    , 195.00, 7, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-7, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 455, 0, 0
                    , 195.00, -2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "7*2021-11-30*195.00,2*2021-12-20*195.00," WHERE transferproductid = 1288;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '4', '9.00', '1', '1288', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('455', '7', '9.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 455, 0, 0
                    , 195.00, 7, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 455, 0, 0
                    , 195.00, 2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '7', '9.00', '0', '1288', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '9.00', '1', '2021-12-20','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', '454', '13.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1562';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 454, 0, 0
                    , 195.00, 13.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-13.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13.00*2021-11-30*195.00," WHERE transferproductid = 1289;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '4', '13.00', '1', '1289', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('454', '7', '13.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 454, 0, 0
                    , 195.00, 13.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '7', '13.00', '0', '1289', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '13.00', '1', '2021-12-20','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', '453', '6.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1564';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 453, 0, 0
                    , 195.00, 6.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6.00*2021-11-30*195.00," WHERE transferproductid = 1290;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '4', '6.00', '1', '1290', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('453', '7', '6.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 453, 0, 0
                    , 195.00, 6.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '7', '6.00', '0', '1290', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '6.00', '1', '2021-12-20','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', '450', '9.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '783';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 450, 0, 0
                    , 280.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-6, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 450, 0, 0
                    , 280.00, -3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 280.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2021-11-08*280.00,3*2021-12-20*280.00," WHERE transferproductid = 1291;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '4', '9.00', '1', '1291', 'تحويل منتجات من المخزن', 'storemovementController.php', '9.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1303';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 450, 0, 0
                    , 280.00, 6, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 450, 0, 0
                    , 280.00, 3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '7', '9.00', '0', '1291', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '32', '1', '2021-12-20','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', '448', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '781';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1292;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('448', '4', '0.00', '1', '1292', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('448', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('448', '7', '0.00', '0', '1292', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '442', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '780';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1293;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('442', '4', '0.00', '1', '1293', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1283';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('442', '7', '0.00', '0', '1293', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','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', '404', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '779';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1294;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('404', '4', '0.00', '1', '1294', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('404', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('404', '7', '0.00', '0', '1294', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '403', '3.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '778';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 403, 0, 0
                    , 240.00, 2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 403, 0, 0
                    , 240.00, -1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 240.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2021-11-08*240.00,1*2021-12-20*240.00," WHERE transferproductid = 1295;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('403', '4', '3.00', '1', '1295', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1582';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 403, 0, 0
                    , 240.00, 2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 403, 0, 0
                    , 240.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('403', '7', '3.00', '0', '1295', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '4', '1', '2021-12-20','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', '402', '11.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '777';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 402, 0, 0
                    , 240.00, 11.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11.00*2021-11-08*240.00," WHERE transferproductid = 1296;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '4', '11.00', '1', '1296', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1746';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 402, 0, 0
                    , 240.00, 11.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '7', '11.00', '0', '1296', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '11', '1', '2021-12-20','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', '401', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '776';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1297;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('401', '4', '0.00', '1', '1297', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('401', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('401', '7', '0.00', '0', '1297', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '400', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '774';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1298;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('400', '4', '0.00', '1', '1298', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('400', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('400', '7', '0.00', '0', '1298', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '392', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '773';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1299;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '4', '0.00', '1', '1299', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('392', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '7', '0.00', '0', '1299', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '391', '18.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '772';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 391, 0, 0
                    , 190.00, 14, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-14, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 391, 0, 0
                    , 190.00, -4, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2021-11-08*190.00,4*2021-12-20*190.00," WHERE transferproductid = 1300;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '4', '18.00', '1', '1300', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('391', '7', '18.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 391, 0, 0
                    , 190.00, 14, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 391, 0, 0
                    , 190.00, 4, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '7', '18.00', '0', '1300', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18.00', '1', '2021-12-20','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', '387', '11.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '771';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 387, 0, 0
                    , 175.00, 10, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 387, 0, 0
                    , 175.00, -1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2021-11-08*175.00,1*2021-12-20*175.00," WHERE transferproductid = 1301;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '4', '11.00', '1', '1301', 'تحويل منتجات من المخزن', 'storemovementController.php', '11.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1296';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 387, 0, 0
                    , 175.00, 10, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 387, 0, 0
                    , 175.00, 1, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '7', '11.00', '0', '1301', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '13', '1', '2021-12-20','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', '386', '20.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '770';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 386, 0, 0
                    , 185.00, 20.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-20.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20.00*2021-11-08*185.00," WHERE transferproductid = 1302;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '4', '20.00', '1', '1302', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1295';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 386, 0, 0
                    , 185.00, 20.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '7', '20.00', '0', '1302', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '3.00', '23', '1', '2021-12-20','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', '385', '15.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '769';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 385, 0, 0
                    , 185.00, 15.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15.00*2021-11-08*185.00," WHERE transferproductid = 1303;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '4', '15.00', '1', '1303', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1294';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 385, 0, 0
                    , 185.00, 15.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '7', '15.00', '0', '1303', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '12.00', '27', '1', '2021-12-20','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', '384', '10.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '768';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 384, 0, 0
                    , 185.00, 10.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-10.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10.00*2021-11-08*185.00," WHERE transferproductid = 1304;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '4', '10.00', '1', '1304', 'تحويل منتجات من المخزن', 'storemovementController.php', '10.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1293';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 384, 0, 0
                    , 185.00, 10.00, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '7', '10.00', '0', '1304', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '12', '1', '2021-12-20','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', '383', '8.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '767';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 383, 0, 0
                    , 185.00, 5, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-5, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 383, 0, 0
                    , 185.00, -3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "5*2021-11-08*185.00,3*2021-12-20*185.00," WHERE transferproductid = 1305;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '4', '8.00', '1', '1305', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1292';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 383, 0, 0
                    , 185.00, 5, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+5, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 383, 0, 0
                    , 185.00, 3, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '7', '8.00', '0', '1305', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '7.00', '15', '1', '2021-12-20','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', '382', '33.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '766';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 382, 0, 0
                    , 190.00, 31, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-31, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 382, 0, 0
                    , 190.00, -2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2021-11-08*190.00,2*2021-12-20*190.00," WHERE transferproductid = 1306;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '4', '33.00', '1', '1306', 'تحويل منتجات من المخزن', 'storemovementController.php', '33.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1291';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 382, 0, 0
                    , 190.00, 31, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 382, 0, 0
                    , 190.00, 2, 0, 0, 1, '2021-12-20 12:04:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '7', '33.00', '0', '1306', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '48', '1', '2021-12-20','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', '376', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1727';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1307;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '4', '0.00', '1', '1307', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '7', '0.00', '0', '1307', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '15', '1', '2021-12-20','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', '370', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1725';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1308;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('370', '4', '0.00', '1', '1308', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('370', '7', '0.00', '0', '1308', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '12.00', '12', '1', '2021-12-20','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', '361', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1723';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1309;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('361', '4', '0.00', '1', '1309', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('361', '7', '0.00', '0', '1309', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '10', '1', '2021-12-20','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', '358', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1720';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1310;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('358', '4', '0.00', '1', '1310', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('358', '7', '0.00', '0', '1310', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '15.00', '15', '1', '2021-12-20','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', '357', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1721';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1311;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '4', '0.00', '1', '1311', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1749';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '7', '0.00', '0', '1311', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '9', '1', '2021-12-20','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', '350', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1719';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1312;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('350', '4', '0.00', '1', '1312', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('350', '7', '0.00', '0', '1312', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '10.00', '10', '1', '2021-12-20','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', '338', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1724';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1313;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('338', '4', '0.00', '1', '1313', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('338', '7', '0.00', '0', '1313', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '4', '1', '2021-12-20','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', '334', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1726';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1314;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('334', '4', '0.00', '1', '1314', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('334', '7', '0.00', '0', '1314', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '18.00', '18', '1', '2021-12-20','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', '325', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '765';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1315;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('325', '4', '0.00', '1', '1315', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('325', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('325', '7', '0.00', '0', '1315', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '324', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '764';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1316;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('324', '4', '0.00', '1', '1316', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('324', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('324', '7', '0.00', '0', '1316', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '315', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '763';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1317;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '4', '0.00', '1', '1317', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('315', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '7', '0.00', '0', '1317', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '312', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '762';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1318;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '4', '0.00', '1', '1318', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('312', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '7', '0.00', '0', '1318', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '302', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:44',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '761';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1319;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('302', '4', '0.00', '1', '1319', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('302', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('302', '7', '0.00', '0', '1319', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '301', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '760';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1320;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('301', '4', '0.00', '1', '1320', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('301', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('301', '7', '0.00', '0', '1320', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '300', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '759';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1321;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('300', '4', '0.00', '1', '1321', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('300', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('300', '7', '0.00', '0', '1321', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '299', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '758';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1322;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '4', '0.00', '1', '1322', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('299', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '7', '0.00', '0', '1322', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '757';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1323;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '4', '0.00', '1', '1323', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('298', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '7', '0.00', '0', '1323', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '297', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '756';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1324;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '4', '0.00', '1', '1324', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('297', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '7', '0.00', '0', '1324', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '296', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '755';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1325;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '4', '0.00', '1', '1325', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('296', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '7', '0.00', '0', '1325', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '295', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '754';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1326;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('295', '4', '0.00', '1', '1326', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('295', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('295', '7', '0.00', '0', '1326', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '294', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '753';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1327;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('294', '4', '0.00', '1', '1327', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('294', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('294', '7', '0.00', '0', '1327', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '293', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '752';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1328;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('293', '4', '0.00', '1', '1328', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('293', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('293', '7', '0.00', '0', '1328', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '751';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1329;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '4', '0.00', '1', '1329', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('292', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '7', '0.00', '0', '1329', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '291', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '750';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1330;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '4', '0.00', '1', '1330', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('291', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '7', '0.00', '0', '1330', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '290', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '749';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1331;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('290', '4', '0.00', '1', '1331', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('290', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('290', '7', '0.00', '0', '1331', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '289', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '748';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1332;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('289', '4', '0.00', '1', '1332', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('289', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('289', '7', '0.00', '0', '1332', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '288', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '747';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1333;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '4', '0.00', '1', '1333', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('288', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '7', '0.00', '0', '1333', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '287', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '746';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1334;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('287', '4', '0.00', '1', '1334', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('287', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('287', '7', '0.00', '0', '1334', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '286', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '745';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1335;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('286', '4', '0.00', '1', '1335', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('286', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('286', '7', '0.00', '0', '1335', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '285', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '744';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1336;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('285', '4', '0.00', '1', '1336', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('285', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('285', '7', '0.00', '0', '1336', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '284', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '743';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1337;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '4', '0.00', '1', '1337', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('284', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '7', '0.00', '0', '1337', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '742';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1338;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '4', '0.00', '1', '1338', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('283', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '7', '0.00', '0', '1338', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '282', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '741';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1339;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('282', '4', '0.00', '1', '1339', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('282', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('282', '7', '0.00', '0', '1339', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '281', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '740';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1340;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('281', '4', '0.00', '1', '1340', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('281', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('281', '7', '0.00', '0', '1340', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '280', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '739';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1341;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '4', '0.00', '1', '1341', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('280', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '7', '0.00', '0', '1341', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '279', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '738';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1342;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '4', '0.00', '1', '1342', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('279', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '7', '0.00', '0', '1342', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '278', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '737';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1343;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('278', '4', '0.00', '1', '1343', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('278', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('278', '7', '0.00', '0', '1343', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '277', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '736';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1344;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('277', '4', '0.00', '1', '1344', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('277', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('277', '7', '0.00', '0', '1344', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '276', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '735';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1345;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('276', '4', '0.00', '1', '1345', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('276', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('276', '7', '0.00', '0', '1345', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '734';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1346;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '4', '0.00', '1', '1346', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('275', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '7', '0.00', '0', '1346', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '274', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '733';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1347;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('274', '4', '0.00', '1', '1347', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('274', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('274', '7', '0.00', '0', '1347', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '273', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '732';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1348;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('273', '4', '0.00', '1', '1348', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('273', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('273', '7', '0.00', '0', '1348', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '272', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '731';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1349;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('272', '4', '0.00', '1', '1349', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('272', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('272', '7', '0.00', '0', '1349', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '271', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '730';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1350;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('271', '4', '0.00', '1', '1350', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('271', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('271', '7', '0.00', '0', '1350', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '270', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '729';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1351;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('270', '4', '0.00', '1', '1351', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('270', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('270', '7', '0.00', '0', '1351', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '269', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '728';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1352;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('269', '4', '0.00', '1', '1352', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('269', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('269', '7', '0.00', '0', '1352', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '268', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '727';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1353;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '4', '0.00', '1', '1353', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('268', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '7', '0.00', '0', '1353', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '267', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '726';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 267, 0, 0
                    , 170.00, -1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-12-20*170.00," WHERE transferproductid = 1354;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '4', '1.00', '1', '1354', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('267', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 267, 0, 0
                    , 170.00, 1.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '7', '1.00', '0', '1354', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '266', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '725';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 266, 0, 0
                    , 170.00, 1.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-11-08*170.00," WHERE transferproductid = 1355;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('266', '4', '1.00', '1', '1355', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('266', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 266, 0, 0
                    , 170.00, 1.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('266', '7', '1.00', '0', '1355', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '265', '1.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '724';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 265, 0, 0
                    , 170.00, 1.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1.00*2021-11-08*170.00," WHERE transferproductid = 1356;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('265', '4', '1.00', '1', '1356', 'تحويل منتجات من المخزن', 'storemovementController.php', '1.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('265', '7', '1.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 265, 0, 0
                    , 170.00, 1.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('265', '7', '1.00', '0', '1356', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '1.00', '1', '2021-12-20','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', '264', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '723';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1357;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('264', '4', '0.00', '1', '1357', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1693';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('264', '7', '0.00', '0', '1357', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '16.00', '16', '1', '2021-12-20','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', '263', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '722';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1358;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('263', '4', '0.00', '1', '1358', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('263', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('263', '7', '0.00', '0', '1358', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '262', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '721';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1359;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '4', '0.00', '1', '1359', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('262', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '7', '0.00', '0', '1359', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '261', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '720';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1360;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('261', '4', '0.00', '1', '1360', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('261', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('261', '7', '0.00', '0', '1360', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '260', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '719';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1361;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('260', '4', '0.00', '1', '1361', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('260', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('260', '7', '0.00', '0', '1361', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '259', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '718';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1362;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '4', '0.00', '1', '1362', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('259', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '7', '0.00', '0', '1362', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '717';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1363;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '4', '0.00', '1', '1363', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('258', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '7', '0.00', '0', '1363', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '257', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '716';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1364;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('257', '4', '0.00', '1', '1364', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('257', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('257', '7', '0.00', '0', '1364', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '256', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '715';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1365;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('256', '4', '0.00', '1', '1365', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('256', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('256', '7', '0.00', '0', '1365', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '253', '3.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1561';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 253, 0, 0
                    , 225.00, 3.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-3.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3.00*2021-11-30*225.00," WHERE transferproductid = 1366;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '4', '3.00', '1', '1366', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1556';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 253, 0, 0
                    , 225.00, 3.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '7', '3.00', '0', '1366', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '26', '1', '2021-12-20','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', '251', '2.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1766';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 251, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 251, 0, 0
                    , 210.00, -1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2021-12-20*210.00,1*2021-12-20*210.00," WHERE transferproductid = 1367;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '4', '2.00', '1', '1367', 'تحويل منتجات من المخزن', 'storemovementController.php', '2.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('251', '7', '2.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 251, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 251, 0, 0
                    , 210.00, 1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '7', '2.00', '0', '1367', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '2.00', '1', '2021-12-20','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', '250', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '714';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1368;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('250', '4', '0.00', '1', '1368', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('250', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('250', '7', '0.00', '0', '1368', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '248', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '713';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1369;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('248', '4', '0.00', '1', '1369', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('248', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('248', '7', '0.00', '0', '1369', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '247', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '712';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1370;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('247', '4', '0.00', '1', '1370', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('247', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('247', '7', '0.00', '0', '1370', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '246', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '711';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1371;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('246', '4', '0.00', '1', '1371', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('246', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('246', '7', '0.00', '0', '1371', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '245', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '710';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1372;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('245', '4', '0.00', '1', '1372', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('245', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('245', '7', '0.00', '0', '1372', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '244', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '709';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1373;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('244', '4', '0.00', '1', '1373', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('244', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('244', '7', '0.00', '0', '1373', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '243', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '708';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1374;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('243', '4', '0.00', '1', '1374', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('243', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('243', '7', '0.00', '0', '1374', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '707';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1375;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '4', '0.00', '1', '1375', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('242', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '7', '0.00', '0', '1375', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '241', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '706';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1376;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('241', '4', '0.00', '1', '1376', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('241', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('241', '7', '0.00', '0', '1376', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '240', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '705';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1377;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '4', '0.00', '1', '1377', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('240', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '7', '0.00', '0', '1377', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '239', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '704';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1378;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '4', '0.00', '1', '1378', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1702';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '7', '0.00', '0', '1378', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '20.00', '20', '1', '2021-12-20','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', '238', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '703';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1379;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('238', '4', '0.00', '1', '1379', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('238', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('238', '7', '0.00', '0', '1379', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '237', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '702';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1380;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('237', '4', '0.00', '1', '1380', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('237', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('237', '7', '0.00', '0', '1380', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '236', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '701';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1381;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('236', '4', '0.00', '1', '1381', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('236', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('236', '7', '0.00', '0', '1381', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '235', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '700';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1382;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('235', '4', '0.00', '1', '1382', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('235', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('235', '7', '0.00', '0', '1382', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '234', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '699';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1383;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '4', '0.00', '1', '1383', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('234', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '7', '0.00', '0', '1383', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '233', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '698';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1384;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('233', '4', '0.00', '1', '1384', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('233', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('233', '7', '0.00', '0', '1384', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '232', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '697';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1385;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('232', '4', '0.00', '1', '1385', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('232', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('232', '7', '0.00', '0', '1385', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '696';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1386;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '4', '0.00', '1', '1386', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('231', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '7', '0.00', '0', '1386', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '230', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '695';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1387;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '4', '0.00', '1', '1387', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('230', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '7', '0.00', '0', '1387', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '229', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '694';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1388;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '4', '0.00', '1', '1388', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('229', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '7', '0.00', '0', '1388', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '228', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '693';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1389;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('228', '4', '0.00', '1', '1389', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('228', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('228', '7', '0.00', '0', '1389', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '227', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '692';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1390;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('227', '4', '0.00', '1', '1390', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('227', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('227', '7', '0.00', '0', '1390', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '226', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '691';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1391;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('226', '4', '0.00', '1', '1391', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('226', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('226', '7', '0.00', '0', '1391', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '225', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '690';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1392;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('225', '4', '0.00', '1', '1392', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('225', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('225', '7', '0.00', '0', '1392', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '224', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '689';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1393;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('224', '4', '0.00', '1', '1393', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('224', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('224', '7', '0.00', '0', '1393', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '223', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '688';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1394;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '4', '0.00', '1', '1394', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('223', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '7', '0.00', '0', '1394', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '222', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '687';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1395;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('222', '4', '0.00', '1', '1395', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('222', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('222', '7', '0.00', '0', '1395', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '221', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '686';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1396;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '4', '0.00', '1', '1396', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('221', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '7', '0.00', '0', '1396', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '220', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '685';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1397;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('220', '4', '0.00', '1', '1397', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('220', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('220', '7', '0.00', '0', '1397', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '219', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '684';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1398;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('219', '4', '0.00', '1', '1398', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('219', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('219', '7', '0.00', '0', '1398', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '218', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '793';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1399;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('218', '4', '0.00', '1', '1399', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('218', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('218', '7', '0.00', '0', '1399', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '209', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '775';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1400;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '4', '0.00', '1', '1400', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('209', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '7', '0.00', '0', '1400', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '164', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1722';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1401;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('164', '4', '0.00', '1', '1401', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1750';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('164', '7', '0.00', '0', '1401', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '18.00', '18', '1', '2021-12-20','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', '133', '8.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '683';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 133, 0, 0
                    , 255.00, 8.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-8.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8.00*2021-11-08*255.00," WHERE transferproductid = 1402;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('133', '4', '8.00', '1', '1402', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('133', '7', '8.00', '1', '2021-12-20');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 133, 0, 0
                    , 255.00, 8.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('133', '7', '8.00', '0', '1402', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '8.00', '1', '2021-12-20','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', '132', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '682';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1403;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('132', '4', '0.00', '1', '1403', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('132', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('132', '7', '0.00', '0', '1403', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '129', '28.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1559';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 129, 0, 0
                    , 235.00, 27, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-27, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 4, 129, 0, 0
                    , 235.00, -1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2021-11-30*235.00,1*2021-12-20*235.00," WHERE transferproductid = 1404;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '4', '28.00', '1', '1404', 'تحويل منتجات من المخزن', 'storemovementController.php', '28.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '80', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1312';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 129, 0, 0
                    , 235.00, 27, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-20', 7, 129, 0, 0
                    , 235.00, 1, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '7', '28.00', '0', '1404', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '52.00', '80', '1', '2021-12-20','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', '127', '16.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '681';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 127, 0, 0
                    , 210.00, 16.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-16.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16.00*2021-11-30*210.00," WHERE transferproductid = 1405;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '4', '16.00', '1', '1405', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1581';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 7, 127, 0, 0
                    , 210.00, 16.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '7', '16.00', '0', '1405', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '17', '1', '2021-12-20','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', '109', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '680';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1406;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '4', '0.00', '1', '1406', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('109', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '7', '0.00', '0', '1406', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '679';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1407;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '4', '0.00', '1', '1407', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('108', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '7', '0.00', '0', '1407', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '24.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '678';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 90, 0, 0
                    , 165.00, 24.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-24.00, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24.00*2021-11-08*165.00," WHERE transferproductid = 1408;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '4', '24.00', '1', '1408', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1258';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 90, 0, 0
                    , 165.00, 24.00, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24.00, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '7', '24.00', '0', '1408', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '24.00', '48', '1', '2021-12-20','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', '85', '24.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '677';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 4, 85, 0, 0
                    , 205.00, 17, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-17, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 4, 85, 0, 0
                    , 205.00, 7, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-7, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "17*2021-11-08*205.00,7*2021-12-12*205.00," WHERE transferproductid = 1409;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '4', '24.00', '1', '1409', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1680';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 7, 85, 0, 0
                    , 205.00, 17, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+17, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-12', 7, 85, 0, 0
                    , 205.00, 7, 0, 0, 1, '2021-12-20 12:04:45')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 12:04:45' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '7', '24.00', '0', '1409', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '23.00', '47', '1', '2021-12-20','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', '66', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '676';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1410;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('66', '4', '0.00', '1', '1410', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('66', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('66', '7', '0.00', '0', '1410', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '36', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '675';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1411;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('36', '4', '0.00', '1', '1411', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('36', '7', '0.00', '1', '2021-12-20');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('36', '7', '0.00', '0', '1411', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '0.00', '1', '2021-12-20','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', '19', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '674';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1412;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('19', '4', '0.00', '1', '1412', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1228';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('19', '7', '0.00', '0', '1412', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','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', '9', '0.00', '2021-12-20', '1', '0','194',null,null,'2021-12-20 12:04:45',null,'','0','','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '673';
UPDATE storemovement SET  buyPricesHistoryBookData = "" WHERE transferproductid = 1413;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '4', '0.00', '1', '1413', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1219';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '7', '0.00', '0', '1413', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '0', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:34:46";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:04:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 12:04:46', '1', 'sucess', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:34:47";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:04:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 12:04:47', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:35:13";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:05:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 12:05:13', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:39:06";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 12:09:06', '1', '', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:41:32";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 12:11:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 12:11:32', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:42:58";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:12:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 12:12:58', '1', 'editshowstyle2', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 08:43:45";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:13:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2021-12-20 12:13:46', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:23:43";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:53:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 12:53:44', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1581';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '7', '19', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '17.00', '36', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:23:45";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 12:53:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 12:53:45', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:47:38";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 13:17:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 13:17:38', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:55:11";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:25:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:25:11', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '117', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1482';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '1', '117', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '117', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:55:13";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:25:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:25:13', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:55:32";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:25:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:25:32', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '465';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '1', '90', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '90', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 09:55:34";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:25:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:25:34', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 10:01:19";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:31:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:31:19', '1', 'add', '197.56.140.213', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1482';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '1', '27', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '117.00', '90', '1', '2021-12-20','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 10:01:21";
UPDATE user SET loginip = "197.56.140.213", lastactivetime = "2021-12-20 13:31:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 13:31:21', '1', 'show', '197.56.140.213', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:01:53";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 14:31:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 14:31:53', '1', '', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:02:23";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 14:32:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2021-12-20 14:32:23', '1', 'show', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:31:34";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:01:34", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 15:01:34', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:32:28";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:02:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 15:02:28', '4', 'add', '197.61.49.205', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'طفطف', '', '200', '2021-12-20', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '230',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('430.00','200', '1', '7', 'إضافة مصروف', '93', '230', '2021-12-20 15:02:28', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '200', '200', '2021-12-20', '4', '0', '0', '2021-12-20 15:02:28','اضافة اسم مصروف( طفطف )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('910', '160', '200', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-20225', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('910', '141', '200', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-46110', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'طفطف', expensesdetails = '', expensesValue = '200.00', expensesdate = '2021-12-20', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '910', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '93';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:32:28";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:02:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 15:02:28', '4', 'sucess', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:32:30";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:02:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 15:02:30', '4', 'show', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:32:35";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:02:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 15:02:35', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 11:37:11";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 15:07:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 15:07:11', '4', 'addsellBill', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 12:42:08";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 16:12:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 16:12:08', '4', '', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 12:42:28";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 16:12:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('returnsellbillController.php', '2021-12-20 16:12:28', '4', 'showDetail', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 12:42:42";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 16:12:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 16:12:42', '4', 'editprint', '197.61.49.205', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 12:42:44";
UPDATE user SET loginip = "197.61.49.205", lastactivetime = "2021-12-20 16:12:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 16:12:45', '4', 'showDetail', '197.61.49.205', '', '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 < "2021-12-20 13:37:21";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 17:07:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 17:07:21', '1', '', '197.56.50.173', '', '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 < "2021-12-20 13:37:22";
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 < "2021-12-20 13:37:37";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 17:07:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 17:07:37', '1', '', '197.56.50.173', '', '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 < "2021-12-20 14:09:27";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:39:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 17:39:27', '7', '', '197.194.18.172', '', '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 < "2021-12-20 14:09: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 < "2021-12-20 14:09:32";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:39:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:39:32', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:09:32";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:39:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:39:32', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:10:22";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:40:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:40:23', '7', 'addAndRetuen', '197.194.18.172', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c0a3b489e18
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 17:39:32', '061c0a3b489e18', '1', '0.00', '0', '5', '1', '295', '290', '290', '0', '5', '2021-12-20 17:40:23', '', '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','اضافة فاتورة مبيعات','383', '0', '2021-12-20 17:40:23', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '290', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 738;
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','00255', '383', '1', '255', '1', '295', '295', '0', '', '1', '2021-12-20 17:40:23', '255', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','738-1,');
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
                where sellbilldetailid = 803;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (255, '2021-12-20', 290, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, 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 (5, '2021-12-20', 290, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, 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 = '8', userid = '7', storedetaildate = '2021-12-20 17:40:23' WHERE storedetailid = '920';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('255', '5', '1', '1', '383', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '8', '7', '2021-12-20 17:40:23','0','0');
UPDATE save SET  savecurrentvalue = '580',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('290.00','290', '0', '5', 'اضافة فاتورة مبيعات', '383', '580', '2021-12-20 17:40:23', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 290, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-12-20', 290, 255, 255
                    , 255, 255, 255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 290, 255, 255
                    , 255, 255, 255, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+290, netSellCostBuyPrice = netSellCostBuyPrice+255
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+255
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+255
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+255
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+255
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c0a3b489e18 and sellbillId = 383 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:10:23";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:40:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:40:24', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:10:29";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:40:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 17:40:30', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:10:30";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:40:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 17:40:30', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:11:09";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:41:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:41:09', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:11:09";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:41:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:41:09', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 7;
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 < "2021-12-20 14:16:00";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 17:46:00', '7', '', '197.194.18.172', '', '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 < "2021-12-20 14:16:00";
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 < "2021-12-20 14:16:01";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 17:46:01', '7', '', '197.194.18.172', '', '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 < "2021-12-20 14:16: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 < "2021-12-20 14:16:06";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:46:06', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:06";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:46:06', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:25";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:46:25', '7', 'add', '197.194.18.172', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('7', 'محمد ممدوح', '', '10', '2021-12-20', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '570',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('580.00','10', '1', '5', 'إضافة مصروف', '94', '570', '2021-12-20 17:46:25', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '10', '10', '2021-12-20', '7', '0', '0', '2021-12-20 17:46:25','اضافة اسم مصروف( محمد ممدوح )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('911', '150', '10', '','0');
UPDATE accountstree SET name = 'ضيافة', customName = 'ضيافة', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '355', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '150';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('911', '139', '10', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-25799', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '139';
UPDATE expenses SET expensestypeid = '7', expensesname = 'محمد ممدوح', expensesdetails = '', expensesValue = '10.00', expensesdate = '2021-12-20', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '911', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '94';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:25";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:46:25', '7', 'sucess', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:27";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:46:27', '7', 'show', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:31";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 17:46:31', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:31";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 17:46:31', '7', '', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:44";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:46:44', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:16:44";
UPDATE user SET loginip = "197.194.18.172", lastactivetime = "2021-12-20 17:46:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:46:44', '7', 'addsellBill', '197.194.18.172', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 7;
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 < "2021-12-20 14:19:45";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:49:45", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-12-20 17:49:45', '8', '', '154.176.48.53', '', '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 < "2021-12-20 14:19:45";
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 < "2021-12-20 14:19:56";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:49:56", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:49:56', '8', 'addsellBill', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:19:57";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:49:57", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:49:57', '8', 'addsellBill', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:20:45";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:50:45", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:50:45', '8', 'addAndRetuen', '154.176.48.53', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061c0a6255feeb
-- ----------------------------------------------------------------------------------------------------

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 ('2021-12-20 17:49:57', '061c0a6255feeb', '1', '0.00', '0', '0', '1', '250', '250', '250', '0', '6', '2021-12-20 17:50:45', '', '8', '0', 'نقدي', '6', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','250','0','','0','0','250','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '8' 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','اضافة فاتورة مبيعات','384', '0', '2021-12-20 17:50:45', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '250', '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 ('210','00465', '384', '1', '465', '1', '250', '250', '0', '', '1', '2021-12-20 17:50:45', '465', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 804;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (465, '2021-12-20', 250, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 (6, '2021-12-20', 250, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 = '11', userid = '8', storedetaildate = '2021-12-20 17:50:45' WHERE storedetailid = '1661';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '6', '1', '1', '384', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12.00', '11', '8', '2021-12-20 17:50:45','0','0');
UPDATE save SET  savecurrentvalue = '755',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('505.00','250', '0', '6', 'اضافة فاتورة مبيعات', '384', '755', '2021-12-20 17:50:45', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-12-20', 250, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-12-20', 250, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 250, 210, 210
                    , 210, 210, 210, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+250, netSellCostBuyPrice = netSellCostBuyPrice+210
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+210
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+210
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+210
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+210
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061c0a6255feeb and sellbillId = 384 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:20:45";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:50:46", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 17:50:46', '8', 'addsellBill', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:20:59";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:50:59", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:50:59', '8', '', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:21:16";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:51:16", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:51:16', '8', 'add', '154.176.48.53', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'فطار', '', '10', '2021-12-20', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '745',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('755.00','10', '1', '6', 'إضافة مصروف', '95', '745', '2021-12-20 17:51:16', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '10', '10', '2021-12-20', '8', '0', '0', '2021-12-20 17:51:16','اضافة اسم مصروف( فطار )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('912', '160', '10', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-20235', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('912', '140', '10', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-12800', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'فطار', expensesdetails = '', expensesValue = '10.00', expensesdate = '2021-12-20', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '912', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '95';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:21:16";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:51:16", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:51:16', '8', 'sucess', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:21:18";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:51:18", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2021-12-20 17:51:18', '8', 'show', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 14:21:25";
UPDATE user SET loginip = "154.176.48.53", lastactivetime = "2021-12-20 17:51:25", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-12-20 17:51:25', '8', '', '154.176.48.53', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 15:21:37";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 18:51:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2021-12-20 18:51:37', '1', 'show', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:13:55";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:43:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 20:43:55', '1', '', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:19:23";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:49:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 20:49:23', '1', 'add', '197.56.50.173', '', '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(195,7,1,555,50,'2021-12-20',1,0, '' ,0,0,0,0,0,'2021-12-20 20:49:23',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1474';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-09', 7, 555, 0, 0
                    , 195.00, 50, 0, 0, 1, '2021-12-20 20:49:23')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-50, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2021-12-20 20:49:23' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "50*2021-12-09*195.00," WHERE transferproductid = 1414;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '7', '50', '1', '1414', 'تحويل منتجات من المخزن', 'storemovementController.php', '62.00', '12', '1', '2021-12-20','0','0');
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2021-12-20' WHERE storedetailid = '1468';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-12-09', 1, 555, 0, 0
                    , 195.00, 50, 0, 0, 1, '2021-12-20 20:49:23')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-12-20 20:49:23' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '50', '0', '1414', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '50', '1', '2021-12-20','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:19:23";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:49:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 20:49:23', '1', 'sucess', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:19:25";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:49:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 20:49:25', '1', 'show', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:19:44";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:49:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-12-20 20:49:44', '1', 'editshowstyle2', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:20:53";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:50:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-12-20 20:50:53', '1', 'addsellBill', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:22:04";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 20:52:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-12-20 20:52:04', '1', '', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:59:27";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 21:29:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 21:29:27', '1', 'show', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-12-20 17:59:45";
UPDATE user SET loginip = "197.56.50.173", lastactivetime = "2021-12-20 21:29:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-12-20 21:29:45', '1', 'show', '197.56.50.173', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
