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 < "2022-02-24 06:04:57";
UPDATE user SET loginip = "197.61.118.107", lastactivetime = "2022-02-24 09:34:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 09:34:57', '4', '', '197.61.118.107', '', '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 = '2022-02-24',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 < "2022-02-24 06:04:58";
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 < "2022-02-24 06:05:00";
UPDATE user SET loginip = "197.61.118.107", lastactivetime = "2022-02-24 09:35:00", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 09:35:00', '4', 'addsellBill', '197.61.118.107', '', '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 < "2022-02-24 06:30:30";
UPDATE user SET loginip = "156.201.2.191", lastactivetime = "2022-02-24 10:00:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 10:00:30', '3', '', '156.201.2.191', '', '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 < "2022-02-24 06:30:30";
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 < "2022-02-24 06:30:34";
UPDATE user SET loginip = "156.201.2.191", lastactivetime = "2022-02-24 10:00:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:00:34', '3', 'addsellBill', '156.201.2.191', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:44:27";
UPDATE user SET loginip = "197.61.118.107", lastactivetime = "2022-02-24 10:14:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:14:27', '4', 'addsellBill', '197.61.118.107', '', '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 < "2022-02-24 06:47:09";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:17:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 10:17:09', '1', '', '156.210.120.130', '', '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 < "2022-02-24 06:47:09";
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 < "2022-02-24 06:49:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:19:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:19:33', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:51:35";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:21:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:21:35', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:51:41";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:21:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2022-02-24 10:21:41', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:53:30";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:23:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2022-02-24 10:23:31', '1', 'add', '156.210.120.130', '', 'DESKTOP');
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid) VALUES ('سمير   سنتر الخواجه' , 'الموسكي', '01286906849', '', '0', '', '0', '2022-02-24 10:23:31', '1', '0','','0','','-10','0','0',',-20,','-1','0','','0','0','.','2022-02-24','0','0','','0','0','0');
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('105', '0', '0', '', '');
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 ('105','0','0','0','إضافة عميل جديد','105', '0', '2022-02-24 10:23:31', '0', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO accountstree (name, customName, parent, itemtype, itemfrom, notes, del, userid, mydate, itemtype2, theValue, theOrder, layingOrder,reportid) VALUES ('سمير   سنتر الخواجه', 'سمير   سنتر الخواجه', '23', '3', '0', '', '0', '1', '2022-02-24', '1', '0', '0', '','2');
UPDATE client SET clientname = 'سمير   سنتر الخواجه', clientaddress = 'الموسكي', clientphone = '01286906849', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2022-02-24', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='0' , typeclientid=',-20,',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0' WHERE clientid = '105';
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:53:31";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:23:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2022-02-24 10:23:31', '1', 'sucess', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:53:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:23:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2022-02-24 10:23:33', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 06:53:38";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:23:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:23:38', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:10:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:40:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:40:18', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:11:31";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:41:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:41:31', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '27';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('27', '1', '95', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '95.00', '0', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:11:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:41:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:41:33', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:11:54";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:41:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:41:54', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '312', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '1', '288', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '24.00', '312', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:11:56";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:41:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 10:41:56', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:24:01";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:54:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:54:01', '1', 'addAndRetuen', '156.210.120.130', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217408a98987
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(105,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2022-02-24 10:23:38', '06217408a98987', '105', '0.00', '126765', '0', '1', '126765', '126765', '0', '126765', '1', '2022-02-24 10:54:01', '', '1', '0', 'سمير   سنتر الخواجه', '1', '1', '3', '0', 'سمير   سنتر الخواجه', '719' ,'0','','','','','-1','0','0','0','0','0','126765','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '126765', userid = '1' WHERE clientid = '105';
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 ('105','0.00','126765','0','اضافة فاتورة مبيعات','1126', '126765', '2022-02-24 10:54:01', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '126765', '0', null, '0', null, null,'', '0','1','1','126765','1');
UPDATE client SET  inUse = 0 where clientid = 105;
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 ('140','00412', '1126', '1', '412', '26', '155', '4030', '0', '', '0', '2022-02-24 10:54:01', '412', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
                where sellbilldetailid = 2324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (412, '2022-02-24', 4030, 3640, 3640
                    , 3640, 3640, 3640, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4030, sellCostBuyPrice =sellCostBuyPrice+3640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3640
                            , 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+26
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4030, 3640, 3640
                    , 3640, 3640, 3640, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4030, sellCostBuyPrice =sellCostBuyPrice+3640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3640
                            , 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 = '26', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '412';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('412', '1', '26', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52.00', '26', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('145','00674', '1126', '1', '674', '20', '145', '2900', '0', '', '0', '2022-02-24 10:54:01', '674', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 145.00 , meanbuyprice = 145.00, lastbuyprice_withDiscount = 145.00, meanbuyprice_withDiscount = 145.00
                where sellbilldetailid = 2325;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (674, '2022-02-24', 2900, 2900, 2900
                    , 2900, 2900, 2900, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2900, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 2900, 2900, 2900
                    , 2900, 2900, 2900, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2900, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , 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 = '92', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1958';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '1', '20', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112.00', '92', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('160','00108', '1126', '1', '108', '25', '165', '4125', '0', '', '0', '2022-02-24 10:54:01', '108', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
                where sellbilldetailid = 2326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (108, '2022-02-24', 4125, 4000, 4000
                    , 4000, 4000, 4000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4125, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , 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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4125, 4000, 4000
                    , 4000, 4000, 4000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4125, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , 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 = '128', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '25', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '153.00', '128', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00109', '1126', '1', '109', '20', '170', '3400', '0', '', '0', '2022-02-24 10:54:01', '109', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 2327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (109, '2022-02-24', 3400, 3700, 3700
                    , 3700, 3700, 3700, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3400, sellCostBuyPrice =sellCostBuyPrice+3700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3700
                            , 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3400, 3700, 3700
                    , 3700, 3700, 3700, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3400, sellCostBuyPrice =sellCostBuyPrice+3700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3700
                            , 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 = '160', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '1', '20', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180.00', '160', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00017', '1126', '1', '17', '22', '195', '4290', '0', '', '0', '2022-02-24 10:54:01', '17', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 2328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (17, '2022-02-24', 4290, 4070, 4070
                    , 4070, 4070, 4070, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4290, sellCostBuyPrice =sellCostBuyPrice+4070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4070, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4070
                            , 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+22
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4290, 4070, 4070
                    , 4070, 4070, 4070, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4290, sellCostBuyPrice =sellCostBuyPrice+4070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4070, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4070
                            , 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 = '64', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '17';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '1', '22', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '86.00', '64', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('145','00678', '1126', '1', '678', '26', '145', '3770', '0', '', '0', '2022-02-24 10:54:01', '678', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 145.00 , meanbuyprice = 145.00, lastbuyprice_withDiscount = 145.00, meanbuyprice_withDiscount = 145.00
                where sellbilldetailid = 2329;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (678, '2022-02-24', 3770, 3770, 3770
                    , 3770, 3770, 3770, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3770, sellCostBuyPrice =sellCostBuyPrice+3770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3770
                            , 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+26
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3770, 3770, 3770
                    , 3770, 3770, 3770, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3770, sellCostBuyPrice =sellCostBuyPrice+3770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3770
                            , 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 = '248', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1962';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '1', '26', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '274.00', '248', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('145','00006', '1126', '1', '6', '26', '155', '4030', '0', '', '0', '2022-02-24 10:54:01', '6', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 145.00 , meanbuyprice = 145.00, lastbuyprice_withDiscount = 145.00, meanbuyprice_withDiscount = 145.00
                where sellbilldetailid = 2330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (6, '2022-02-24', 4030, 3770, 3770
                    , 3770, 3770, 3770, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4030, sellCostBuyPrice =sellCostBuyPrice+3770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3770
                            , 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+26
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4030, 3770, 3770
                    , 3770, 3770, 3770, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4030, sellCostBuyPrice =sellCostBuyPrice+3770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3770
                            , 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 = '159', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '26', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '185.00', '159', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('155','00003', '1126', '1', '3', '26', '165', '4290', '0', '', '0', '2022-02-24 10:54:01', '3', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (3, '2022-02-24', 4290, 4030, 4030
                    , 4030, 4030, 4030, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4290, sellCostBuyPrice =sellCostBuyPrice+4030
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4030, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4030
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4030
                            , 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+26
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4290, 4030, 4030
                    , 4030, 4030, 4030, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4290, sellCostBuyPrice =sellCostBuyPrice+4030
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4030, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4030
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4030
                            , 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 = '55', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '26', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '81.00', '55', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00593', '1126', '1', '593', '24', '200', '4800', '0', '', '0', '2022-02-24 10:54:01', '593', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 192.50, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 192.50
                where sellbilldetailid = 2332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (593, '2022-02-24', 4800, 4440, 4800
                    , 4620, 4800, 4620, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4620
                            , 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+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4800, 4440, 4800
                    , 4620, 4800, 4620, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4620
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4620
                            , 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 = '168', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1610';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '24', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '192.00', '168', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('280','00647', '1126', '1', '647', '23', '285', '6555', '0', '', '0', '2022-02-24 10:54:01', '647', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 2333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (647, '2022-02-24', 6555, 6440, 6440
                    , 6440, 6440, 6440, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6555, sellCostBuyPrice =sellCostBuyPrice+6440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6440
                            , 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+23
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 6555, 6440, 6440
                    , 6440, 6440, 6440, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6555, sellCostBuyPrice =sellCostBuyPrice+6440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6440
                            , 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 = '201', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1927';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '1', '23', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '224.00', '201', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('170','00643', '1126', '1', '643', '24', '175', '4200', '0', '', '0', '2022-02-24 10:54:01', '643', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 170.00 , meanbuyprice = 170.00, lastbuyprice_withDiscount = 170.00, meanbuyprice_withDiscount = 170.00
                where sellbilldetailid = 2334;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (643, '2022-02-24', 4200, 4080, 4080
                    , 4080, 4080, 4080, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , 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+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4200, 4080, 4080
                    , 4080, 4080, 4080, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , 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 = '81', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1923';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '1', '24', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105.00', '81', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('165','00676', '1126', '1', '676', '29', '165', '4785', '0', '', '0', '2022-02-24 10:54:01', '676', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 165.00 , meanbuyprice = 165.00, lastbuyprice_withDiscount = 165.00, meanbuyprice_withDiscount = 165.00
                where sellbilldetailid = 2335;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (676, '2022-02-24', 4785, 4785, 4785
                    , 4785, 4785, 4785, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 29, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4785, sellCostBuyPrice =sellCostBuyPrice+4785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4785, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4785
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4785, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4785
                            , 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+29
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4785, 4785, 4785
                    , 4785, 4785, 4785, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4785, sellCostBuyPrice =sellCostBuyPrice+4785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4785, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4785
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4785, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4785
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1960';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '1', '29', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59.00', '30', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00662', '1126', '1', '662', '30', '185', '5550', '0', '', '0', '2022-02-24 10:54:01', '662', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 2336;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (662, '2022-02-24', 5550, 5550, 5550
                    , 5550, 5550, 5550, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5550, sellCostBuyPrice =sellCostBuyPrice+5550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5550
                            , 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+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 5550, 5550, 5550
                    , 5550, 5550, 5550, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5550, sellCostBuyPrice =sellCostBuyPrice+5550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5550
                            , 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 = '53', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1943';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('662', '1', '30', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '83.00', '53', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00645', '1126', '1', '645', '28', '210', '5880', '0', '', '0', '2022-02-24 10:54:01', '645', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (645, '2022-02-24', 5880, 5740, 5740
                    , 5740, 5740, 5740, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5880, sellCostBuyPrice =sellCostBuyPrice+5740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5740
                            , 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+28
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 5880, 5740, 5740
                    , 5740, 5740, 5740, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5880, sellCostBuyPrice =sellCostBuyPrice+5740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5740
                            , 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 = '173', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1925';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '1', '28', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '201.00', '173', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('155','00097', '1126', '1', '97', '19', '165', '3135', '0', '', '0', '2022-02-24 10:54:01', '97', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (97, '2022-02-24', 3135, 2945, 2945
                    , 2945, 2945, 2945, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3135, sellCostBuyPrice =sellCostBuyPrice+2945
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2945, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2945
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2945
                            , 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+19
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3135, 2945, 2945
                    , 2945, 2945, 2945, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3135, sellCostBuyPrice =sellCostBuyPrice+2945
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2945, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2945
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2945
                            , 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 = '128', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '97';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('97', '1', '19', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '147.00', '128', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('200','00123', '1126', '1', '123', '24', '180', '4320', '0', '', '0', '2022-02-24 10:54:01', '123', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 200.00
                where sellbilldetailid = 2339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (123, '2022-02-24', 4320, 4800, 4800
                    , 4800, 4800, 4800, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , 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+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4320, 4800, 4800
                    , 4800, 4800, 4800, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , 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 = '261', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '24', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '285.00', '261', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('150','00283', '1126', '1', '283', '30', '155', '4650', '0', '', '0', '2022-02-24 10:54:01', '283', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2340;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (283, '2022-02-24', 4650, 4500, 4500
                    , 4500, 4500, 4500, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4650, sellCostBuyPrice =sellCostBuyPrice+4500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4500
                            , 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+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4650, 4500, 4500
                    , 4500, 4500, 4500, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4650, sellCostBuyPrice =sellCostBuyPrice+4500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4500
                            , 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 = '207', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '283';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '30', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '237.00', '207', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('140','00416', '1126', '1', '416', '22', '155', '3410', '0', '', '0', '2022-02-24 10:54:01', '416', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
                where sellbilldetailid = 2341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (416, '2022-02-24', 3410, 3080, 3080
                    , 3080, 3080, 3080, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3410, sellCostBuyPrice =sellCostBuyPrice+3080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3080
                            , 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+22
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3410, 3080, 3080
                    , 3080, 3080, 3080, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3410, sellCostBuyPrice =sellCostBuyPrice+3080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3080
                            , 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 = '150', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '22', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '172.00', '150', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00146', '1126', '1', '146', '22', '200', '4400', '0', '', '0', '2022-02-24 10:54:01', '146', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (146, '2022-02-24', 4400, 3960, 3960
                    , 3960, 3960, 3960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4400, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3960
                            , 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+22
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4400, 3960, 3960
                    , 3960, 3960, 3960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4400, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3960
                            , 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 = '290', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '1', '22', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '312.00', '290', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('155','00681', '1126', '1', '681', '23', '155', '3565', '0', '', '0', '2022-02-24 10:54:01', '681', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2343;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (681, '2022-02-24', 3565, 3565, 3565
                    , 3565, 3565, 3565, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3565, sellCostBuyPrice =sellCostBuyPrice+3565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3565
                            , 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+23
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3565, 3565, 3565
                    , 3565, 3565, 3565, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3565, sellCostBuyPrice =sellCostBuyPrice+3565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3565
                            , 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 = '279', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1965';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '1', '23', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '302.00', '279', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00492', '1126', '1', '492', '32', '200', '6400', '0', '', '0', '2022-02-24 10:54:01', '492', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2344;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (492, '2022-02-24', 6400, 5760, 5760
                    , 5760, 5760, 5760, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6400, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5760
                            , 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+32
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 6400, 5760, 5760
                    , 5760, 5760, 5760, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6400, sellCostBuyPrice =sellCostBuyPrice+5760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5760
                            , 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 = '302', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '492';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('492', '1', '32', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '334.00', '302', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('155','00299', '1126', '1', '299', '23', '165', '3795', '0', '', '0', '2022-02-24 10:54:01', '299', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2345;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (299, '2022-02-24', 3795, 3565, 3565
                    , 3565, 3565, 3565, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3795, sellCostBuyPrice =sellCostBuyPrice+3565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3565
                            , 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+23
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3795, 3565, 3565
                    , 3565, 3565, 3565, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3795, sellCostBuyPrice =sellCostBuyPrice+3565
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3565, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3565
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3565, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3565
                            , 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 = '615', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '299';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '1', '23', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '638.00', '615', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('160','00436', '1126', '1', '436', '25', '170', '4250', '0', '', '0', '2022-02-24 10:54:01', '436', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
                where sellbilldetailid = 2346;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (436, '2022-02-24', 4250, 4000, 4000
                    , 4000, 4000, 4000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4250, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , 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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4250, 4000, 4000
                    , 4000, 4000, 4000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4250, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , 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 = '178', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '436';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '1', '25', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '203.00', '178', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('125','00432', '1126', '1', '432', '24', '145', '3480', '0', '', '0', '2022-02-24 10:54:01', '432', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 125.00 , meanbuyprice = 125.00, lastbuyprice_withDiscount = 125.00, meanbuyprice_withDiscount = 125.00
                where sellbilldetailid = 2347;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (432, '2022-02-24', 3480, 3000, 3000
                    , 3000, 3000, 3000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , 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+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3480, 3000, 3000
                    , 3000, 3000, 3000, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3000
                            , 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 = '198', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '432';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('432', '1', '24', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '222.00', '198', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('210','00634', '1126', '1', '634', '20', '220', '4400', '0', '', '0', '2022-02-24 10:54:01', '634', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 2348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (634, '2022-02-24', 4400, 4200, 4200
                    , 4200, 4200, 4200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4400, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , 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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4400, 4200, 4200
                    , 4200, 4200, 4200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4400, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , 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 = '299', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1911';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '1', '20', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '319.00', '299', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('175','00022', '1126', '1', '22', '23', '165', '3795', '0', '', '0', '2022-02-24 10:54:01', '22', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 175.00 , meanbuyprice = 175.00, lastbuyprice_withDiscount = 175.00, meanbuyprice_withDiscount = 175.00
                where sellbilldetailid = 2349;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (22, '2022-02-24', 3795, 4025, 4025
                    , 4025, 4025, 4025, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3795, sellCostBuyPrice =sellCostBuyPrice+4025
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4025, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4025
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4025, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4025
                            , 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+23
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3795, 4025, 4025
                    , 4025, 4025, 4025, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3795, sellCostBuyPrice =sellCostBuyPrice+4025
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4025, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4025
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4025, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4025
                            , 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 = '119', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '22';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '1', '23', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '142.00', '119', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('155','00010', '1126', '1', '10', '28', '165', '4620', '0', '', '0', '2022-02-24 10:54:01', '10', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2350;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (10, '2022-02-24', 4620, 4340, 4340
                    , 4340, 4340, 4340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4620, sellCostBuyPrice =sellCostBuyPrice+4340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4340
                            , 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+28
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 4620, 4340, 4340
                    , 4340, 4340, 4340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4620, sellCostBuyPrice =sellCostBuyPrice+4340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4340
                            , 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 = '101', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '28', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '129.00', '101', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('210','00635', '1126', '1', '635', '28', '220', '6160', '0', '', '0', '2022-02-24 10:54:01', '635', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 2351;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (635, '2022-02-24', 6160, 5880, 5880
                    , 5880, 5880, 5880, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6160, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5880
                            , 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+28
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 6160, 5880, 5880
                    , 5880, 5880, 5880, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6160, sellCostBuyPrice =sellCostBuyPrice+5880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5880
                            , 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 = '227', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1912';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '1', '28', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '255.00', '227', '1', '2022-02-24 10:54:01','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('140','00641', '1126', '1', '641', '27', '140', '3780', '0', '', '0', '2022-02-24 10:54:01', '641', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
                where sellbilldetailid = 2352;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (641, '2022-02-24', 3780, 3780, 3780
                    , 3780, 3780, 3780, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3780, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , 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+27
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 3780, 3780, 3780
                    , 3780, 3780, 3780, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3780, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , 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 = '79', userid = '1', storedetaildate = '2022-02-24 10:54:01' WHERE storedetailid = '1920';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('641', '1', '27', '1', '1126', 'اضافة فاتورة مبيعات', 'sellbillController.php', '106.00', '79', '1', '2022-02-24 10:54:01','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 126765, 122315, 122675
                    , 122495, 122675, 122495, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+126765, sellCostBuyPrice =sellCostBuyPrice+122315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+122675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+122495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+122675, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+122495
                            , 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 (105, '2022-02-24', 126765, 122315, 122675
                    , 122495, 122675, 122495, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+126765, sellCostBuyPrice =sellCostBuyPrice+122315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+122675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+122495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+122675, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+122495
                            , 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, 126765, 122315, 122675
                    , 122495, 122675, 122495, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+126765, netSellCostBuyPrice = netSellCostBuyPrice+122315
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+122675
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+122495
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+122675
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+122495
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217408a98987 and sellbillId = 1126 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:24:02";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 10:54:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 10:54:02', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:33:57";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:03:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2022-02-24 11:03:58', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2022-02-24 11:04:08', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:26";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2022-02-24 11:04:27', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:32";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:04:32', '1', 'showDetail', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:36";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2022-02-24 11:04:36', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:38";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:04:38', '1', 'showDetail', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:41";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2022-02-24 11:04:41', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:34:44";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:04:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:04:44', '1', 'showDetail', '156.210.120.130', '', '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 < "2022-02-24 07:59:18";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:18", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 11:29:18', '8', '', '41.233.228.216', '', '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 < "2022-02-24 07:59:18";
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 < "2022-02-24 07:59:30";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:30", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 11:29:30', '8', '', '41.233.228.216', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:59:48";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:48", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 11:29:48', '8', 'add', '41.233.228.216', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'فطار', '', '10', '2022-02-24', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '2260',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2270.00','10', '1', '6', 'إضافة مصروف', '398', '2260', '2022-02-24 11:29:48', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '10', '10', '2022-02-24', '8', '0', '0', '2022-02-24 11:29:48','اضافة اسم مصروف( فطار )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1530', '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 = '-83620', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1530', '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 = '-47625', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'فطار', expensesdetails = '', expensesValue = '10.00', expensesdate = '2022-02-24', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '1530', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '398';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:59:48";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:48", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 11:29:48', '8', 'sucess', '41.233.228.216', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:59:50";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:50", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 11:29:50', '8', 'show', '41.233.228.216', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 07:59:53";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:29:53", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 11:29:53', '8', '', '41.233.228.216', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:06:38";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:36:38", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 11:36:38', '8', '', '41.233.228.216', '', '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 < "2022-02-24 08:06:38";
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 < "2022-02-24 08:06:42";
UPDATE user SET loginip = "41.233.228.216", lastactivetime = "2022-02-24 11:36:42", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:36:42', '8', 'addsellBill', '41.233.228.216', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:17:38";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:47:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 11:47:38', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '1320', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1934';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('653', '1', '1320', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '1320', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:17:43";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:47:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 11:47:43', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:17:53";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:47:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:47:53', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:19:16";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:49:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:49:16', '1', 'addAndRetuen', '156.210.120.130', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 062175449602fa
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(14,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2022-02-24 11:47:53', '062175449602fa', '14', '74416.00', '111376', '0', '1', '36960', '36960', '0', '36960', '1', '2022-02-24 11:49:16', '', '1', '0', 'محمد السيد طيور الجنة', '1', '1', '3', '0', 'محمد السيد طيور الجنة', '1320' ,'0','','','','','-1','0','0','0','0','0','36960','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '111376', userid = '1' WHERE clientid = '14';
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 ('14','74416.00','36960','0','اضافة فاتورة مبيعات','1127', '111376', '2022-02-24 11:49:16', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '36960', '0', null, '0', null, null,'', '0','1','1','36960','1');
UPDATE client SET  inUse = 0 where clientid = 14;
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 ('28','00653', '1127', '2', '653', '1320', '28.00', '36960', '0', '', '0', '2022-02-24 11:49:16', '653', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 28.00 , meanbuyprice = 28.00, lastbuyprice_withDiscount = 28.00, meanbuyprice_withDiscount = 28.00
                where sellbilldetailid = 2353;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (653, '2022-02-24', 36960, 36960, 36960
                    , 36960, 36960, 36960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1320, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36960, sellCostBuyPrice =sellCostBuyPrice+36960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36960
                            , 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+1320
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 36960, 36960, 36960
                    , 36960, 36960, 36960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36960, sellCostBuyPrice =sellCostBuyPrice+36960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36960
                            , 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 = '1', storedetaildate = '2022-02-24 11:49:16' WHERE storedetailid = '1934';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('653', '1', '1320', '1', '1127', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1320.00', '0', '1', '2022-02-24 11:49:16','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 36960, 36960, 36960
                    , 36960, 36960, 36960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36960, sellCostBuyPrice =sellCostBuyPrice+36960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36960
                            , 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 (14, '2022-02-24', 36960, 36960, 36960
                    , 36960, 36960, 36960, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36960, sellCostBuyPrice =sellCostBuyPrice+36960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36960
                            , 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, 36960, 36960, 36960
                    , 36960, 36960, 36960, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+36960, netSellCostBuyPrice = netSellCostBuyPrice+36960
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+36960
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+36960
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+36960
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+36960
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 062175449602fa and sellbillId = 1127 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:19:16";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:49:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:49:16', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:23:52";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:53:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 11:53:52', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '100', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1933';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('652', '1', '100', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '100', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:23:53";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:53:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 11:53:53', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:23:58";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:53:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:53:58', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:24:23";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:54:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:54:23', '1', 'addAndRetuen', '156.210.120.130', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0621755b68a9ce
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(14,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2022-02-24 11:53:58', '0621755b68a9ce', '14', '111376.00', '114026', '0', '1', '2650', '2650', '0', '2650', '1', '2022-02-24 11:54:23', '', '1', '0', 'محمد السيد طيور الجنة', '1', '1', '3', '0', 'محمد السيد طيور الجنة', '100' ,'0','','','','','-1','0','0','0','0','0','2650','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '114026', userid = '1' WHERE clientid = '14';
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 ('14','111376.00','2650','0','اضافة فاتورة مبيعات','1128', '114026', '2022-02-24 11:54:23', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2650', '0', null, '0', null, null,'', '0','1','1','2650','1');
UPDATE client SET  inUse = 0 where clientid = 14;
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 ('26.5','00652', '1128', '2', '652', '100', '26.50', '2650', '0', '', '0', '2022-02-24 11:54:23', '652', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 26.50 , meanbuyprice = 26.50, lastbuyprice_withDiscount = 26.50, meanbuyprice_withDiscount = 26.50
                where sellbilldetailid = 2354;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (652, '2022-02-24', 2650, 2650, 2650
                    , 2650, 2650, 2650, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , 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+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 2650, 2650, 2650
                    , 2650, 2650, 2650, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , 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 = '1', storedetaildate = '2022-02-24 11:54:23' WHERE storedetailid = '1933';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('652', '1', '100', '1', '1128', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100.00', '0', '1', '2022-02-24 11:54:23','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 2650, 2650, 2650
                    , 2650, 2650, 2650, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , 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 (14, '2022-02-24', 2650, 2650, 2650
                    , 2650, 2650, 2650, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , 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, 2650, 2650, 2650
                    , 2650, 2650, 2650, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2650, netSellCostBuyPrice = netSellCostBuyPrice+2650
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2650
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2650
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2650
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2650
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0621755b68a9ce and sellbillId = 1128 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:24:23";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:54:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 11:54:23', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:29:20";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:59:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 11:59:20', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:29:30";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:59:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 11:59:30', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:29:36";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 11:59:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 11:59:36', '1', 'editshowstyle2', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:30:24";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:00:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:00:24', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:31:20";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:01:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:01:20', '1', 'add', '156.210.120.130', '', '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(257,8,1,649,36,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 12:01:20',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2029';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-22', 8, 649, 0, 0
                    , 185.00, 36, 0, 0, 1, '2022-02-24 12:01:20')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2022-02-24 12:01:20' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-22*185.00," WHERE transferproductid = 1652;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('649', '8', '36', '1', '1652', 'تحويل منتجات من المخزن', 'storemovementController.php', '73.00', '37', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1929';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-22', 1, 649, 0, 0
                    , 185.00, 36, 0, 0, 1, '2022-02-24 12:01:20')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 12:01:20' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('649', '1', '36', '0', '1652', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '6.00', '42', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:31:20";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:01:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:01:20', '1', 'sucess', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:31:22";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:01:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:01:22', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:34:23";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:04:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 12:04:24', '1', 'show', '156.210.120.130', '', '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 < "2022-02-24 08:43:36";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:13:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 12:13:36', '4', '', '41.232.89.131', '', '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 < "2022-02-24 08:43:36";
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 < "2022-02-24 08:43:43";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:13:43", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:13:43', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:50:50";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:20:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:20:50', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:58:13";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:28:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:28:13', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '101', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '99.00', '101', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 08:58:15";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:28:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:28:15', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:00:30";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:30:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:30:30', '1', 'editshowstyle2', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:00:38";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:30:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:30:38', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:00:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:30:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:30:47', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:00:53";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:30:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 12:30:53', '1', 'editshowstyle2', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:09:38";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:39:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:39:39', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '77', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '75.00', '77', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:09:40";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:39:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:39:40', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:10:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:40:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:40:08', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '72.00', '74', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:10:10";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 12:40:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 12:40:10', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:10:11";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:40:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:40:11', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:18:53";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:48:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:48:53', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:20:16";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:50:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:50:16', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:20:16";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:50:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:50:17', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:26:41";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 12:56:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 12:56:41', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:30:05";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:00:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:00:05', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:42:56";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:12:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:12:56', '1', 'add', '156.210.120.130', '', '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 ('ادم8815','','1','205','205', '245','215', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '205','205','205','205','205','0','0','4.88','19.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8815', productDescription = '', productCatId = '1', productBuyPrice = '205', productSellAllPrice = '205', productSellUnitPrice = '245', productSellHalfPrice = '215', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00730',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '730';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '730', '1', '2022-02-24', '1', '0','0073001','205','215','245','205');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('730', '1', '28', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('730', '1', '28', '0', '730', 'إضافة منتج', 'productController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (730, 1,'2022-02-24 13:12:56',1)
                ON DUPLICATE KEY UPDATE productid = 730, edited = 1, sysdate = '2022-02-24 13:12:56', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '5740', '5740', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:56','إضافة منتج ادم8815 الكمية 28','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1531', '19', '5740', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6602819.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1531', '7', '5740', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7454520.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8815', productDescription = '', productCatId = '1', productBuyPrice = '205.00', productSellAllPrice = '205.00', productSellUnitPrice = '245.00', productSellHalfPrice = '215.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00730',type ='0', expireDate = '0' , dailyentryId = '1531',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '730';
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 ('ادم3030','','1','205','205', '245','215', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '205','205','205','205','205','0','0','4.88','19.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3030', productDescription = '', productCatId = '1', productBuyPrice = '205', productSellAllPrice = '205', productSellUnitPrice = '245', productSellHalfPrice = '215', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00731',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '731';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '731', '1', '2022-02-24', '1', '0','0073101','205','215','245','205');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('731', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('731', '1', '20', '0', '731', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (731, 1,'2022-02-24 13:12:56',1)
                ON DUPLICATE KEY UPDATE productid = 731, edited = 1, sysdate = '2022-02-24 13:12:56', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4100', '4100', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:56','إضافة منتج ادم3030 الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1532', '19', '4100', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6606919.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1532', '7', '4100', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7458620.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3030', productDescription = '', productCatId = '1', productBuyPrice = '205.00', productSellAllPrice = '205.00', productSellUnitPrice = '245.00', productSellHalfPrice = '215.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00731',type ='0', expireDate = '0' , dailyentryId = '1532',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '731';
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 ('ادم8016','','1','205','205', '245','215', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '205','205','205','205','205','0','0','4.88','19.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8016', productDescription = '', productCatId = '1', productBuyPrice = '205', productSellAllPrice = '205', productSellUnitPrice = '245', productSellHalfPrice = '215', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00732',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '732';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '732', '1', '2022-02-24', '1', '0','0073201','205','215','245','205');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('732', '1', '27', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('732', '1', '27', '0', '732', 'إضافة منتج', 'productController.php', '0', '27', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (732, 1,'2022-02-24 13:12:56',1)
                ON DUPLICATE KEY UPDATE productid = 732, edited = 1, sysdate = '2022-02-24 13:12:56', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '5535', '5535', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:56','إضافة منتج ادم8016 الكمية 27','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1533', '19', '5535', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6612454.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1533', '7', '5535', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7464155.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8016', productDescription = '', productCatId = '1', productBuyPrice = '205.00', productSellAllPrice = '205.00', productSellUnitPrice = '245.00', productSellHalfPrice = '215.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00732',type ='0', expireDate = '0' , dailyentryId = '1533',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '732';
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 ('ادم3065','','1','150','150', '190','160', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '150','150','150','150','150','0','0','6.67','26.67','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3065', productDescription = '', productCatId = '1', productBuyPrice = '150', productSellAllPrice = '150', productSellUnitPrice = '190', productSellHalfPrice = '160', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00733',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '733';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '733', '1', '2022-02-24', '1', '0','0073301','150','160','190','150');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('733', '1', '24', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('733', '1', '24', '0', '733', 'إضافة منتج', 'productController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (733, 1,'2022-02-24 13:12:56',1)
                ON DUPLICATE KEY UPDATE productid = 733, edited = 1, sysdate = '2022-02-24 13:12:56', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3600', '3600', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:56','إضافة منتج ادم3065 الكمية 24','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1534', '19', '3600', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6616054.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1534', '7', '3600', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7467755.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3065', productDescription = '', productCatId = '1', productBuyPrice = '150.00', productSellAllPrice = '150.00', productSellUnitPrice = '190.00', productSellHalfPrice = '160.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00733',type ='0', expireDate = '0' , dailyentryId = '1534',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '733';
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 ('ادم8030','','1','205','205', '245','215', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '205','205','205','205','205','0','0','4.88','19.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8030', productDescription = '', productCatId = '1', productBuyPrice = '205', productSellAllPrice = '205', productSellUnitPrice = '245', productSellHalfPrice = '215', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00734',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '734';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '734', '1', '2022-02-24', '1', '0','0073401','205','215','245','205');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('734', '1', '16', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('734', '1', '16', '0', '734', 'إضافة منتج', 'productController.php', '0', '16', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (734, 1,'2022-02-24 13:12:57',1)
                ON DUPLICATE KEY UPDATE productid = 734, edited = 1, sysdate = '2022-02-24 13:12:57', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3280', '3280', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:57','إضافة منتج ادم8030 الكمية 16','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1535', '19', '3280', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6619334.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1535', '7', '3280', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7471035.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8030', productDescription = '', productCatId = '1', productBuyPrice = '205.00', productSellAllPrice = '205.00', productSellUnitPrice = '245.00', productSellHalfPrice = '215.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00734',type ='0', expireDate = '0' , dailyentryId = '1535',isService = '0',isOptic = '0',lastbuyprice = '205',lastbuyprice_withDiscount = '205',meanbuyprice = '205',meanbuyprice_withDiscount = '205' , productbuypricereal = '205' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '19.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '734';
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 ('ادم3025','','1','180','180', '220','190', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '180','180','180','180','180','0','0','5.56','22.22','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3025', productDescription = '', productCatId = '1', productBuyPrice = '180', productSellAllPrice = '180', productSellUnitPrice = '220', productSellHalfPrice = '190', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00735',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '180',lastbuyprice_withDiscount = '180',meanbuyprice = '180',meanbuyprice_withDiscount = '180' , productbuypricereal = '180' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.56' , buypart_precentage = '22.22',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '735';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '735', '1', '2022-02-24', '1', '0','0073501','180','190','220','180');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('735', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('735', '1', '20', '0', '735', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (735, 1,'2022-02-24 13:12:57',1)
                ON DUPLICATE KEY UPDATE productid = 735, edited = 1, sysdate = '2022-02-24 13:12:57', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3600', '3600', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:57','إضافة منتج ادم3025 الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1536', '19', '3600', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6622934.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1536', '7', '3600', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7474635.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3025', productDescription = '', productCatId = '1', productBuyPrice = '180.00', productSellAllPrice = '180.00', productSellUnitPrice = '220.00', productSellHalfPrice = '190.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00735',type ='0', expireDate = '0' , dailyentryId = '1536',isService = '0',isOptic = '0',lastbuyprice = '180',lastbuyprice_withDiscount = '180',meanbuyprice = '180',meanbuyprice_withDiscount = '180' , productbuypricereal = '180' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.56' , buypart_precentage = '22.22',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '735';
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 ('ادم4041','','1','150','150', '190','160', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '150','150','150','150','150','0','0','6.67','26.67','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم4041', productDescription = '', productCatId = '1', productBuyPrice = '150', productSellAllPrice = '150', productSellUnitPrice = '190', productSellHalfPrice = '160', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00736',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '736';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '736', '1', '2022-02-24', '1', '0','0073601','150','160','190','150');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('736', '1', '18', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('736', '1', '18', '0', '736', 'إضافة منتج', 'productController.php', '0', '18', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (736, 1,'2022-02-24 13:12:57',1)
                ON DUPLICATE KEY UPDATE productid = 736, edited = 1, sysdate = '2022-02-24 13:12:57', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2700', '2700', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:57','إضافة منتج ادم4041 الكمية 18','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1537', '19', '2700', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6625634.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1537', '7', '2700', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7477335.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم4041', productDescription = '', productCatId = '1', productBuyPrice = '150.00', productSellAllPrice = '150.00', productSellUnitPrice = '190.00', productSellHalfPrice = '160.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00736',type ='0', expireDate = '0' , dailyentryId = '1537',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '736';
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 ('ادم3015','','1','195','195', '235','205', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '195','195','195','195','195','0','0','5.13','20.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3015', productDescription = '', productCatId = '1', productBuyPrice = '195', productSellAllPrice = '195', productSellUnitPrice = '235', productSellHalfPrice = '205', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00737',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '195',lastbuyprice_withDiscount = '195',meanbuyprice = '195',meanbuyprice_withDiscount = '195' , productbuypricereal = '195' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.13' , buypart_precentage = '20.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '737';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '737', '1', '2022-02-24', '1', '0','0073701','195','205','235','195');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('737', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('737', '1', '20', '0', '737', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (737, 1,'2022-02-24 13:12:57',1)
                ON DUPLICATE KEY UPDATE productid = 737, edited = 1, sysdate = '2022-02-24 13:12:57', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3900', '3900', '2022-02-24', '1', '0', '0', '2022-02-24 13:12:57','إضافة منتج ادم3015 الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1538', '19', '3900', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6629534.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1538', '7', '3900', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7481235.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3015', productDescription = '', productCatId = '1', productBuyPrice = '195.00', productSellAllPrice = '195.00', productSellUnitPrice = '235.00', productSellHalfPrice = '205.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00737',type ='0', expireDate = '0' , dailyentryId = '1538',isService = '0',isOptic = '0',lastbuyprice = '195',lastbuyprice_withDiscount = '195',meanbuyprice = '195',meanbuyprice_withDiscount = '195' , productbuypricereal = '195' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.13' , buypart_precentage = '20.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '737';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:42:59";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:12:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:12:59', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:43:00";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:13:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 13:13:00', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:45:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:15:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 13:15:18', '1', 'add', '156.210.120.130', '', '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(258,1,7,730,28,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 13:15:18',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2134';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 730, 0, 0
                    , 205.00, -28, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*205.00," WHERE transferproductid = 1653;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('730', '1', '28', '1', '1653', 'تحويل منتجات من المخزن', 'storemovementController.php', '28.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('730', '7', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 730, 0, 0
                    , 205.00, 28, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('730', '7', '28', '0', '1653', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '731', '20', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2135';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 731, 0, 0
                    , 205.00, -20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*205.00," WHERE transferproductid = 1654;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('731', '1', '20', '1', '1654', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('731', '7', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 731, 0, 0
                    , 205.00, 20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('731', '7', '20', '0', '1654', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '732', '27', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2136';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 732, 0, 0
                    , 205.00, -27, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2022-02-24*205.00," WHERE transferproductid = 1655;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('732', '1', '27', '1', '1655', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('732', '7', '27', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 732, 0, 0
                    , 205.00, 27, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('732', '7', '27', '0', '1655', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '733', '24', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2137';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 733, 0, 0
                    , 150.00, -24, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*150.00," WHERE transferproductid = 1656;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('733', '1', '24', '1', '1656', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('733', '7', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 733, 0, 0
                    , 150.00, 24, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('733', '7', '24', '0', '1656', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '734', '16', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2138';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 734, 0, 0
                    , 205.00, -16, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-02-24*205.00," WHERE transferproductid = 1657;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('734', '1', '16', '1', '1657', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('734', '7', '16', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 734, 0, 0
                    , 205.00, 16, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('734', '7', '16', '0', '1657', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '16', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '735', '20', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2139';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 735, 0, 0
                    , 180.00, -20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*180.00," WHERE transferproductid = 1658;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('735', '1', '20', '1', '1658', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('735', '7', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 735, 0, 0
                    , 180.00, 20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('735', '7', '20', '0', '1658', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '736', '18', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2140';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 736, 0, 0
                    , 150.00, -18, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18*2022-02-24*150.00," WHERE transferproductid = 1659;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('736', '1', '18', '1', '1659', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('736', '7', '18', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 736, 0, 0
                    , 150.00, 18, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('736', '7', '18', '0', '1659', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '737', '20', '2022-02-24', '1', '0','258',null,null,'2022-02-24 13:15:18',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2141';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 737, 0, 0
                    , 195.00, -20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*195.00," WHERE transferproductid = 1660;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('737', '1', '20', '1', '1660', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('737', '7', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 737, 0, 0
                    , 195.00, 20, 0, 0, 1, '2022-02-24 13:15:18')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 13:15:18' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('737', '7', '20', '0', '1660', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:45:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:15:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 13:15:18', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 09:46:37";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 13:16:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 13:16:37', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:15:49";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:45:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 13:45:49', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:22:26";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:52:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:52:26', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:22:50";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:52:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:52:50', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:24:36";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 13:54:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 13:54:36', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:30:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:00:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:00:08', '1', 'add', '156.210.120.130', '', '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 ('دكرون4007','','1','190','190', '230','200', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '190','190','190','190','190','0','0','5.26','21.05','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'دكرون4007', productDescription = '', productCatId = '1', productBuyPrice = '190', productSellAllPrice = '190', productSellUnitPrice = '230', productSellHalfPrice = '200', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00738',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '738';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '738', '1', '2022-02-24', '1', '0','0073801','190','200','230','190');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('738', '1', '228', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '1', '228', '0', '738', 'إضافة منتج', 'productController.php', '0', '228', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (738, 1,'2022-02-24 14:00:09',1)
                ON DUPLICATE KEY UPDATE productid = 738, edited = 1, sysdate = '2022-02-24 14:00:09', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '43320', '43320', '2022-02-24', '1', '0', '0', '2022-02-24 14:00:09','إضافة منتج دكرون4007 الكمية 228','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1539', '19', '43320', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6672854.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1539', '7', '43320', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7524555.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'دكرون4007', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '190.00', productSellUnitPrice = '230.00', productSellHalfPrice = '200.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00738',type ='0', expireDate = '0' , dailyentryId = '1539',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '738';
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 ('دكرون4003','','1','190','190', '230','200', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '190','190','190','190','190','0','0','5.26','21.05','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'دكرون4003', productDescription = '', productCatId = '1', productBuyPrice = '190', productSellAllPrice = '190', productSellUnitPrice = '230', productSellHalfPrice = '200', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '739';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '739', '1', '2022-02-24', '1', '0','0073901','190','200','230','190');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('739', '1', '0', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '1', '0', '0', '739', 'إضافة منتج', 'productController.php', '0', '0', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (739, 1,'2022-02-24 14:00:09',1)
                ON DUPLICATE KEY UPDATE productid = 739, edited = 1, sysdate = '2022-02-24 14:00:09', userid = 1;
UPDATE product SET productName = 'دكرون4003', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '190.00', productSellUnitPrice = '230.00', productSellHalfPrice = '200.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00739',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '739';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:30:10";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:00:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:00:10', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:32:44";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:02:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:02:44', '1', 'add', '156.210.120.130', '', '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 ('عمر الشريف فسكوز 555','','1','135','135', '175','145', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '135','135','135','135','135','0','0','7.41','29.63','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف فسكوز 555', productDescription = '', productCatId = '1', productBuyPrice = '135', productSellAllPrice = '135', productSellUnitPrice = '175', productSellHalfPrice = '145', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00740',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '135',lastbuyprice_withDiscount = '135',meanbuyprice = '135',meanbuyprice_withDiscount = '135' , productbuypricereal = '135' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '7.41' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '740';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '740', '1', '2022-02-24', '1', '0','0074001','135','145','175','135');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('740', '1', '50', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('740', '1', '50', '0', '740', 'إضافة منتج', 'productController.php', '0', '50', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (740, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 740, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6750', '6750', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف فسكوز 555 الكمية 50','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1540', '19', '6750', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6679604.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1540', '7', '6750', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7531305.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف فسكوز 555', productDescription = '', productCatId = '1', productBuyPrice = '135.00', productSellAllPrice = '135.00', productSellUnitPrice = '175.00', productSellHalfPrice = '145.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00740',type ='0', expireDate = '0' , dailyentryId = '1540',isService = '0',isOptic = '0',lastbuyprice = '135',lastbuyprice_withDiscount = '135',meanbuyprice = '135',meanbuyprice_withDiscount = '135' , productbuypricereal = '135' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '7.41' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '740';
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 ('عمر الشريف مراسي 1900','','1','150','150', '190','160', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '150','150','150','150','150','0','0','6.67','26.67','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1900', productDescription = '', productCatId = '1', productBuyPrice = '150', productSellAllPrice = '150', productSellUnitPrice = '190', productSellHalfPrice = '160', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00741',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '741';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '741', '1', '2022-02-24', '1', '0','0074101','150','160','190','150');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('741', '1', '24', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('741', '1', '24', '0', '741', 'إضافة منتج', 'productController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (741, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 741, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3600', '3600', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف مراسي 1900 الكمية 24','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1541', '19', '3600', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6683204.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1541', '7', '3600', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7534905.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1900', productDescription = '', productCatId = '1', productBuyPrice = '150.00', productSellAllPrice = '150.00', productSellUnitPrice = '190.00', productSellHalfPrice = '160.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00741',type ='0', expireDate = '0' , dailyentryId = '1541',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '741';
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 ('عمر الشريف مراسي 2900','','1','150','150', '190','160', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '150','150','150','150','150','0','0','6.67','26.67','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 2900', productDescription = '', productCatId = '1', productBuyPrice = '150', productSellAllPrice = '150', productSellUnitPrice = '190', productSellHalfPrice = '160', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00742',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '742';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '742', '1', '2022-02-24', '1', '0','0074201','150','160','190','150');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('742', '1', '30', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('742', '1', '30', '0', '742', 'إضافة منتج', 'productController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (742, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 742, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4500', '4500', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف مراسي 2900 الكمية 30','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1542', '19', '4500', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6687704.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1542', '7', '4500', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7539405.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 2900', productDescription = '', productCatId = '1', productBuyPrice = '150.00', productSellAllPrice = '150.00', productSellUnitPrice = '190.00', productSellHalfPrice = '160.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00742',type ='0', expireDate = '0' , dailyentryId = '1542',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '742';
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 ('عمر الشريف مراسي 1400','','1','150','150', '190','160', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '150','150','150','150','150','0','0','6.67','26.67','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1400', productDescription = '', productCatId = '1', productBuyPrice = '150', productSellAllPrice = '150', productSellUnitPrice = '190', productSellHalfPrice = '160', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00743',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '743';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '743', '1', '2022-02-24', '1', '0','0074301','150','160','190','150');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('743', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('743', '1', '20', '0', '743', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (743, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 743, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3000', '3000', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف مراسي 1400 الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1543', '19', '3000', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6690704.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1543', '7', '3000', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7542405.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1400', productDescription = '', productCatId = '1', productBuyPrice = '150.00', productSellAllPrice = '150.00', productSellUnitPrice = '190.00', productSellHalfPrice = '160.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00743',type ='0', expireDate = '0' , dailyentryId = '1543',isService = '0',isOptic = '0',lastbuyprice = '150',lastbuyprice_withDiscount = '150',meanbuyprice = '150',meanbuyprice_withDiscount = '150' , productbuypricereal = '150' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '743';
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 ('عمر الشريف كوريشة امهات','','1','155','155', '195','165', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '155','155','155','155','155','0','0','6.45','25.81','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف كوريشة امهات', productDescription = '', productCatId = '1', productBuyPrice = '155', productSellAllPrice = '155', productSellUnitPrice = '195', productSellHalfPrice = '165', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00744',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '155',lastbuyprice_withDiscount = '155',meanbuyprice = '155',meanbuyprice_withDiscount = '155' , productbuypricereal = '155' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.45' , buypart_precentage = '25.81',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '744';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '744', '1', '2022-02-24', '1', '0','0074401','155','165','195','155');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('744', '1', '40', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('744', '1', '40', '0', '744', 'إضافة منتج', 'productController.php', '0', '40', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (744, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 744, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6200', '6200', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف كوريشة امهات الكمية 40','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1544', '19', '6200', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6696904.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1544', '7', '6200', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7548605.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف كوريشة امهات', productDescription = '', productCatId = '1', productBuyPrice = '155.00', productSellAllPrice = '155.00', productSellUnitPrice = '195.00', productSellHalfPrice = '165.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00744',type ='0', expireDate = '0' , dailyentryId = '1544',isService = '0',isOptic = '0',lastbuyprice = '155',lastbuyprice_withDiscount = '155',meanbuyprice = '155',meanbuyprice_withDiscount = '155' , productbuypricereal = '155' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.45' , buypart_precentage = '25.81',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '744';
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 ('عمر الشريف ستان جاكار','','1','175','175', '215','185', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '175','175','175','175','175','0','0','5.71','22.86','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف ستان جاكار', productDescription = '', productCatId = '1', productBuyPrice = '175', productSellAllPrice = '175', productSellUnitPrice = '215', productSellHalfPrice = '185', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00745',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '175',lastbuyprice_withDiscount = '175',meanbuyprice = '175',meanbuyprice_withDiscount = '175' , productbuypricereal = '175' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.71' , buypart_precentage = '22.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '745';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '745', '1', '2022-02-24', '1', '0','0074501','175','185','215','175');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('745', '1', '25', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('745', '1', '25', '0', '745', 'إضافة منتج', 'productController.php', '0', '25', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (745, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 745, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4375', '4375', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف ستان جاكار الكمية 25','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1545', '19', '4375', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6701279.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1545', '7', '4375', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7552980.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف ستان جاكار', productDescription = '', productCatId = '1', productBuyPrice = '175.00', productSellAllPrice = '175.00', productSellUnitPrice = '215.00', productSellHalfPrice = '185.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00745',type ='0', expireDate = '0' , dailyentryId = '1545',isService = '0',isOptic = '0',lastbuyprice = '175',lastbuyprice_withDiscount = '175',meanbuyprice = '175',meanbuyprice_withDiscount = '175' , productbuypricereal = '175' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.71' , buypart_precentage = '22.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '745';
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 ('عمر الشريف مراسي 1700','','1','155','155', '195','165', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '155','155','155','155','155','0','0','6.45','25.81','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1700', productDescription = '', productCatId = '1', productBuyPrice = '155', productSellAllPrice = '155', productSellUnitPrice = '195', productSellHalfPrice = '165', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00746',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '155',lastbuyprice_withDiscount = '155',meanbuyprice = '155',meanbuyprice_withDiscount = '155' , productbuypricereal = '155' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.45' , buypart_precentage = '25.81',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '746';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '746', '1', '2022-02-24', '1', '0','0074601','155','165','195','155');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('746', '1', '30', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '1', '30', '0', '746', 'إضافة منتج', 'productController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (746, 1,'2022-02-24 14:02:45',1)
                ON DUPLICATE KEY UPDATE productid = 746, edited = 1, sysdate = '2022-02-24 14:02:45', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4650', '4650', '2022-02-24', '1', '0', '0', '2022-02-24 14:02:45','إضافة منتج عمر الشريف مراسي 1700 الكمية 30','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1546', '19', '4650', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6705929.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1546', '7', '4650', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7557630.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1700', productDescription = '', productCatId = '1', productBuyPrice = '155.00', productSellAllPrice = '155.00', productSellUnitPrice = '195.00', productSellHalfPrice = '165.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00746',type ='0', expireDate = '0' , dailyentryId = '1546',isService = '0',isOptic = '0',lastbuyprice = '155',lastbuyprice_withDiscount = '155',meanbuyprice = '155',meanbuyprice_withDiscount = '155' , productbuypricereal = '155' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.45' , buypart_precentage = '25.81',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '746';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:32:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:02:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:02:47', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:32:49";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:02:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:02:49', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:48:43";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:18:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:18:43', '1', 'add', '156.210.120.130', '', '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(259,1,7,740,50,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 14:18:43',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2152';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 740, 0, 0
                    , 135.00, -50, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 135.00,
                        buyQuantity =buyQuantity+-50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "50*2022-02-24*135.00," WHERE transferproductid = 1661;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('740', '1', '50', '1', '1661', 'تحويل منتجات من المخزن', 'storemovementController.php', '50.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('740', '7', '50', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 740, 0, 0
                    , 135.00, 50, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('740', '7', '50', '0', '1661', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '50', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '741', '24', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2153';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 741, 0, 0
                    , 150.00, -24, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*150.00," WHERE transferproductid = 1662;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('741', '1', '24', '1', '1662', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('741', '7', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 741, 0, 0
                    , 150.00, 24, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('741', '7', '24', '0', '1662', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '742', '30', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2154';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 742, 0, 0
                    , 150.00, -30, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*150.00," WHERE transferproductid = 1663;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('742', '1', '30', '1', '1663', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('742', '7', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 742, 0, 0
                    , 150.00, 30, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('742', '7', '30', '0', '1663', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '743', '20', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2155';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 743, 0, 0
                    , 150.00, -20, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*150.00," WHERE transferproductid = 1664;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('743', '1', '20', '1', '1664', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('743', '7', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 743, 0, 0
                    , 150.00, 20, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('743', '7', '20', '0', '1664', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '744', '40', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2156';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 744, 0, 0
                    , 155.00, -40, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "40*2022-02-24*155.00," WHERE transferproductid = 1665;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('744', '1', '40', '1', '1665', 'تحويل منتجات من المخزن', 'storemovementController.php', '40.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('744', '7', '40', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 744, 0, 0
                    , 155.00, 40, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('744', '7', '40', '0', '1665', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '40', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '745', '25', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2157';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 745, 0, 0
                    , 175.00, -25, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "25*2022-02-24*175.00," WHERE transferproductid = 1666;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('745', '1', '25', '1', '1666', 'تحويل منتجات من المخزن', 'storemovementController.php', '25.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('745', '7', '25', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 745, 0, 0
                    , 175.00, 25, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('745', '7', '25', '0', '1666', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '25', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '7', '746', '30', '2022-02-24', '1', '0','259',null,null,'2022-02-24 14:18:43',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2158';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 746, 0, 0
                    , 155.00, -30, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*155.00," WHERE transferproductid = 1667;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '1', '30', '1', '1667', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('746', '7', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 7, 746, 0, 0
                    , 155.00, 30, 0, 0, 1, '2022-02-24 14:18:43')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:18:43' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '7', '30', '0', '1667', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:48:43";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:18:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:18:43', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:50:01";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:20:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:20:01', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0621769154db95
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 13:16:37', '0621769154db95', '1', '0.00', '0', '15', '1', '225', '210', '210', '0', '7', '2022-02-24 14:20:01', '', '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','اضافة فاتورة مبيعات','1129', '0', '2022-02-24 14:20:01', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '210', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2826;
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','00560', '1129', '1', '560', '1', '225.00', '225', '0', '', '0', '2022-02-24 14:20:01', '560', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2826-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 2355;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (560, '2022-02-24', 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, '2022-02-24', 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 = '26', userid = '4', storedetaildate = '2022-02-24 14:20:01' WHERE storedetailid = '1931';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '7', '1', '1', '1129', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27.00', '26', '4', '2022-02-24 14:20:01','0','0');
UPDATE save SET  savecurrentvalue = '2255',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2045.00','210', '0', '7', 'اضافة فاتورة مبيعات', '1129', '2255', '2022-02-24 14:20:01', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 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, '2022-02-24', 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 0621769154db95 and sellbillId = 1129 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:50:02";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:20:02", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:20:02', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:50:10";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:20:10", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 14:20:10', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:50:48";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:20:48", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:20:48', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:50:50";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:20:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:20:51', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:53:22";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:23:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:23:22', '1', 'add', '156.210.120.130', '', '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 ('9000','','1','195','195', '235','205', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '195','195','195','195','195','0','0','5.13','20.51','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '9000', productDescription = '', productCatId = '1', productBuyPrice = '195', productSellAllPrice = '195', productSellUnitPrice = '235', productSellHalfPrice = '205', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00747',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '195',lastbuyprice_withDiscount = '195',meanbuyprice = '195',meanbuyprice_withDiscount = '195' , productbuypricereal = '195' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.13' , buypart_precentage = '20.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '747';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '747', '1', '2022-02-24', '1', '0','0074701','195','205','235','195');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('747', '1', '0', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '1', '0', '0', '747', 'إضافة منتج', 'productController.php', '0', '0', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (747, 1,'2022-02-24 14:23:22',1)
                ON DUPLICATE KEY UPDATE productid = 747, edited = 1, sysdate = '2022-02-24 14:23:22', userid = 1;
UPDATE product SET productName = '9000', productDescription = '', productCatId = '1', productBuyPrice = '195.00', productSellAllPrice = '195.00', productSellUnitPrice = '235.00', productSellHalfPrice = '205.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00747',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '195',lastbuyprice_withDiscount = '195',meanbuyprice = '195',meanbuyprice_withDiscount = '195' , productbuypricereal = '195' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.13' , buypart_precentage = '20.51',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '747';
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 ('9001','','1','185','185', '225','195', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '185','185','185','185','185','0','0','5.41','21.62','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '9001', productDescription = '', productCatId = '1', productBuyPrice = '185', productSellAllPrice = '185', productSellUnitPrice = '225', productSellHalfPrice = '195', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00748',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '185',lastbuyprice_withDiscount = '185',meanbuyprice = '185',meanbuyprice_withDiscount = '185' , productbuypricereal = '185' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.41' , buypart_precentage = '21.62',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '748';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '748', '1', '2022-02-24', '1', '0','0074801','185','195','225','185');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('748', '1', '0', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '1', '0', '0', '748', 'إضافة منتج', 'productController.php', '0', '0', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (748, 1,'2022-02-24 14:23:22',1)
                ON DUPLICATE KEY UPDATE productid = 748, edited = 1, sysdate = '2022-02-24 14:23:22', userid = 1;
UPDATE product SET productName = '9001', productDescription = '', productCatId = '1', productBuyPrice = '185.00', productSellAllPrice = '185.00', productSellUnitPrice = '225.00', productSellHalfPrice = '195.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00748',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '185',lastbuyprice_withDiscount = '185',meanbuyprice = '185',meanbuyprice_withDiscount = '185' , productbuypricereal = '185' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.41' , buypart_precentage = '21.62',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '748';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:53:24";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:23:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:23:24', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:55:14";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:25:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:25:14', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:58:56";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:28:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:28:56', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217792a8756f
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 14:25:14', '06217792a8756f', '1', '0.00', '0', '0', '1', '1835', '1835', '1835', '0', '7', '2022-02-24 14:28:56', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','1835','0','','0','0','1835','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','اضافة فاتورة مبيعات','1130', '0', '2022-02-24 14:28:56', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1835', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3064;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('280','00647', '1130', '1', '647', '2', '285', '570', '0', '', '0', '2022-02-24 14:28:56', '647', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3064-2,');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 2356;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (647, '2022-02-24', 570, 560, 560
                    , 560, 560, 560, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+560
                            , 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, '2022-02-24', 570, 560, 560
                    , 560, 560, 560, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+560
                            , 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 = '64', userid = '4', storedetaildate = '2022-02-24 14:28:56' WHERE storedetailid = '2073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '2', '1', '1130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66.00', '64', '4', '2022-02-24 14:28:56','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3096;
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 ('150','00714', '1130', '1', '714', '2', '150', '300', '0', '', '0', '2022-02-24 14:28:56', '714', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3096-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2357;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (714, '2022-02-24', 300, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 300, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '16', userid = '4', storedetaildate = '2022-02-24 14:28:56' WHERE storedetailid = '2107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('714', '7', '2', '1', '1130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '16', '4', '2022-02-24 14:28:56','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3162;
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 ('150','00742', '1130', '1', '742', '1', '150', '150', '0', '', '0', '2022-02-24 14:28:56', '742', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3162-1,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (742, '2022-02-24', 150, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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, '2022-02-24', 150, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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 = '29', userid = '4', storedetaildate = '2022-02-24 14:28:56' WHERE storedetailid = '2161';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('742', '7', '1', '1', '1130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30.00', '29', '4', '2022-02-24 14:28:56','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3100;
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 ('175','00718', '1130', '1', '718', '2', '175', '350', '0', '', '0', '2022-02-24 14:28:56', '718', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3100-2,');
UPDATE sellbilldetail SET  lastbuyprice = 175.00 , meanbuyprice = 175.00, lastbuyprice_withDiscount = 175.00, meanbuyprice_withDiscount = 175.00
                where sellbilldetailid = 2359;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (718, '2022-02-24', 350, 350, 350
                    , 350, 350, 350, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+350
                            , 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, '2022-02-24', 350, 350, 350
                    , 350, 350, 350, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+350
                            , 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 = '16', userid = '4', storedetaildate = '2022-02-24 14:28:56' WHERE storedetailid = '2109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('718', '7', '2', '1', '1130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '16', '4', '2022-02-24 14:28:56','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3170;
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 ('155','00746', '1130', '1', '746', '3', '155', '465', '0', '', '0', '2022-02-24 14:28:56', '746', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3170-3,');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2360;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (746, '2022-02-24', 465, 465, 465
                    , 465, 465, 465, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+465, sellCostBuyPrice =sellCostBuyPrice+465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+465
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 465, 465, 465
                    , 465, 465, 465, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+465, sellCostBuyPrice =sellCostBuyPrice+465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+465
                            , 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 = '27', userid = '4', storedetaildate = '2022-02-24 14:28:56' WHERE storedetailid = '2165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '7', '3', '1', '1130', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30.00', '27', '4', '2022-02-24 14:28:56','0','0');
UPDATE save SET  savecurrentvalue = '4090',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2255.00','1835', '0', '7', 'اضافة فاتورة مبيعات', '1130', '4090', '2022-02-24 14:28:56', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 1835, 1825, 1825
                    , 1825, 1825, 1825, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1835, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , 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, '2022-02-24', 1835, 1825, 1825
                    , 1825, 1825, 1825, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1835, sellCostBuyPrice =sellCostBuyPrice+1825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1825
                            , 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, 1835, 1825, 1825
                    , 1825, 1825, 1825, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1835, netSellCostBuyPrice = netSellCostBuyPrice+1825
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1825
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1825
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1825
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1825
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217792a8756f and sellbillId = 1130 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 10:58:57";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:28:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:28:57', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:00:29";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:30:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:30:29', '1', 'add', '156.210.120.130', '', '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 ('عمر الشريف فسكوز 555 الاسكندرية','','1','145','145', '185','155', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '145','145','145','145','145','0','0','6.9','27.59','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف فسكوز 555 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '145', productSellAllPrice = '145', productSellUnitPrice = '185', productSellHalfPrice = '155', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00749',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '145',lastbuyprice_withDiscount = '145',meanbuyprice = '145',meanbuyprice_withDiscount = '145' , productbuypricereal = '145' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.9' , buypart_precentage = '27.59',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '749';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '749', '1', '2022-02-24', '1', '0','0074901','145','155','185','145');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('749', '1', '50', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('749', '1', '50', '0', '749', 'إضافة منتج', 'productController.php', '0', '50', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (749, 1,'2022-02-24 14:30:29',1)
                ON DUPLICATE KEY UPDATE productid = 749, edited = 1, sysdate = '2022-02-24 14:30:29', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '7250', '7250', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:29','إضافة منتج عمر الشريف فسكوز 555 الاسكندرية الكمية 50','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1547', '19', '7250', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6713179.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1547', '7', '7250', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7564880.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف فسكوز 555 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '145.00', productSellAllPrice = '145.00', productSellUnitPrice = '185.00', productSellHalfPrice = '155.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00749',type ='0', expireDate = '0' , dailyentryId = '1547',isService = '0',isOptic = '0',lastbuyprice = '145',lastbuyprice_withDiscount = '145',meanbuyprice = '145',meanbuyprice_withDiscount = '145' , productbuypricereal = '145' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.9' , buypart_precentage = '27.59',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '749';
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 ('عمر الشريف مراسي 1600 الاسكندرية','','1','160','160', '200','170', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '160','160','160','160','160','0','0','6.25','25','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1600 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160', productSellAllPrice = '160', productSellUnitPrice = '200', productSellHalfPrice = '170', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00750',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '750';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '750', '1', '2022-02-24', '1', '0','0075001','160','170','200','160');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('750', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('750', '1', '20', '0', '750', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (750, 1,'2022-02-24 14:30:29',1)
                ON DUPLICATE KEY UPDATE productid = 750, edited = 1, sysdate = '2022-02-24 14:30:29', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3200', '3200', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:29','إضافة منتج عمر الشريف مراسي 1600 الاسكندرية الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1548', '19', '3200', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6716379.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1548', '7', '3200', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7568080.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1600 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160.00', productSellAllPrice = '160.00', productSellUnitPrice = '200.00', productSellHalfPrice = '170.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00750',type ='0', expireDate = '0' , dailyentryId = '1548',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '750';
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 ('عمر الشريف مراسي 2900 الاسكندرية','','1','160','160', '200','170', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '160','160','160','160','160','0','0','6.25','25','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 2900 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160', productSellAllPrice = '160', productSellUnitPrice = '200', productSellHalfPrice = '170', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00751',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '751';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '751', '1', '2022-02-24', '1', '0','0075101','160','170','200','160');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('751', '1', '30', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('751', '1', '30', '0', '751', 'إضافة منتج', 'productController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (751, 1,'2022-02-24 14:30:30',1)
                ON DUPLICATE KEY UPDATE productid = 751, edited = 1, sysdate = '2022-02-24 14:30:30', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4800', '4800', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:30','إضافة منتج عمر الشريف مراسي 2900 الاسكندرية الكمية 30','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1549', '19', '4800', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6721179.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1549', '7', '4800', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7572880.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 2900 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160.00', productSellAllPrice = '160.00', productSellUnitPrice = '200.00', productSellHalfPrice = '170.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00751',type ='0', expireDate = '0' , dailyentryId = '1549',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '751';
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 ('عمر الشريف مراسي 1400 الاسكندرية','','1','160','160', '200','170', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '160','160','160','160','160','0','0','6.25','25','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1400 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160', productSellAllPrice = '160', productSellUnitPrice = '200', productSellHalfPrice = '170', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00752',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '752';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '752', '1', '2022-02-24', '1', '0','0075201','160','170','200','160');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('752', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('752', '1', '20', '0', '752', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (752, 1,'2022-02-24 14:30:30',1)
                ON DUPLICATE KEY UPDATE productid = 752, edited = 1, sysdate = '2022-02-24 14:30:30', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3200', '3200', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:30','إضافة منتج عمر الشريف مراسي 1400 الاسكندرية الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1550', '19', '3200', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6724379.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1550', '7', '3200', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7576080.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1400 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160.00', productSellAllPrice = '160.00', productSellUnitPrice = '200.00', productSellHalfPrice = '170.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00752',type ='0', expireDate = '0' , dailyentryId = '1550',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '752';
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 ('عمر الشريف كوريشة امهات الاسكندرية','','1','165','165', '205','175', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','0','6.06','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف كوريشة امهات الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '165', productSellUnitPrice = '205', productSellHalfPrice = '175', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00753',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 = '0' , buyhalf_precentage = '6.06' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '753';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '753', '1', '2022-02-24', '1', '0','0075301','165','175','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('753', '1', '40', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('753', '1', '40', '0', '753', 'إضافة منتج', 'productController.php', '0', '40', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (753, 1,'2022-02-24 14:30:30',1)
                ON DUPLICATE KEY UPDATE productid = 753, edited = 1, sysdate = '2022-02-24 14:30:30', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6600', '6600', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:30','إضافة منتج عمر الشريف كوريشة امهات الاسكندرية الكمية 40','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1551', '19', '6600', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6730979.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1551', '7', '6600', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7582680.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف كوريشة امهات الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '165.00', productSellUnitPrice = '205.00', productSellHalfPrice = '175.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00753',type ='0', expireDate = '0' , dailyentryId = '1551',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.06' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '753';
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 ('عمر الشريف ستان جاكار الاسكندرية','','1','185','185', '225','195', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '185','185','185','185','185','0','0','5.41','21.62','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف ستان جاكار الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '185', productSellAllPrice = '185', productSellUnitPrice = '225', productSellHalfPrice = '195', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00754',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '185',lastbuyprice_withDiscount = '185',meanbuyprice = '185',meanbuyprice_withDiscount = '185' , productbuypricereal = '185' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.41' , buypart_precentage = '21.62',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '754';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '754', '1', '2022-02-24', '1', '0','0075401','185','195','225','185');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('754', '1', '25', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('754', '1', '25', '0', '754', 'إضافة منتج', 'productController.php', '0', '25', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (754, 1,'2022-02-24 14:30:30',1)
                ON DUPLICATE KEY UPDATE productid = 754, edited = 1, sysdate = '2022-02-24 14:30:30', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4625', '4625', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:30','إضافة منتج عمر الشريف ستان جاكار الاسكندرية الكمية 25','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1552', '19', '4625', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6735604.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1552', '7', '4625', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7587305.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف ستان جاكار الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '185.00', productSellAllPrice = '185.00', productSellUnitPrice = '225.00', productSellHalfPrice = '195.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00754',type ='0', expireDate = '0' , dailyentryId = '1552',isService = '0',isOptic = '0',lastbuyprice = '185',lastbuyprice_withDiscount = '185',meanbuyprice = '185',meanbuyprice_withDiscount = '185' , productbuypricereal = '185' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.41' , buypart_precentage = '21.62',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '754';
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 ('عمر الشريف مراسي 1700 الاسكندرية','','1','165','165', '205','175', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '165','165','165','165','165','0','0','6.06','24.24','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'عمر الشريف مراسي 1700 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '165', productSellAllPrice = '165', productSellUnitPrice = '205', productSellHalfPrice = '175', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00755',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 = '0' , buyhalf_precentage = '6.06' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '755';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '755', '1', '2022-02-24', '1', '0','0075501','165','175','205','165');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('755', '1', '30', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('755', '1', '30', '0', '755', 'إضافة منتج', 'productController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (755, 1,'2022-02-24 14:30:30',1)
                ON DUPLICATE KEY UPDATE productid = 755, edited = 1, sysdate = '2022-02-24 14:30:30', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4950', '4950', '2022-02-24', '1', '0', '0', '2022-02-24 14:30:30','إضافة منتج عمر الشريف مراسي 1700 الاسكندرية الكمية 30','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1553', '19', '4950', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6740554.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1553', '7', '4950', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7592255.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'عمر الشريف مراسي 1700 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '165.00', productSellAllPrice = '165.00', productSellUnitPrice = '205.00', productSellHalfPrice = '175.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00755',type ='0', expireDate = '0' , dailyentryId = '1553',isService = '0',isOptic = '0',lastbuyprice = '165',lastbuyprice_withDiscount = '165',meanbuyprice = '165',meanbuyprice_withDiscount = '165' , productbuypricereal = '165' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.06' , buypart_precentage = '24.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '755';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:00:32";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:30:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 14:30:32', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:00:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:30:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:30:33', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:01:57";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:31:58", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:31:58', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 062177a094b55b
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 14:28:57', '062177a094b55b', '1', '0.00', '0', '140', '1', '2990', '2850', '2850', '0', '7', '2022-02-24 14:31:58', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '14' ,'0','','','','','-1','0','0','0','0','0','2850','0','','0','0','2850','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','اضافة فاتورة مبيعات','1131', '0', '2022-02-24 14:31:58', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2850', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3038;
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 ('195','00525', '1131', '1', '525', '2', '215', '430', '0', '', '0', '2022-02-24 14:31:58', '525', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3038-2,');
UPDATE sellbilldetail SET  lastbuyprice = 195.00 , meanbuyprice = 195.00, lastbuyprice_withDiscount = 195.00, meanbuyprice_withDiscount = 195.00
                where sellbilldetailid = 2361;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (525, '2022-02-24', 409.866220736, 390, 390
                    , 390, 390, 390, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+409.866220736, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , 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, '2022-02-24', 409.866220736, 390, 390
                    , 390, 390, 390, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+409.866220736, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , 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 = '36', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2063';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '7', '2', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '38.00', '36', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3012;
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','00570', '1131', '1', '570', '1', '220', '220', '0', '', '0', '2022-02-24 14:31:58', '570', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3012-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 2362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (570, '2022-02-24', 209.698996656, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+209.698996656, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 209.698996656, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+209.698996656, 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 = '59', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2055';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '7', '1', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60.00', '59', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3064;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('280','00647', '1131', '1', '647', '3', '285', '855', '0', '', '0', '2022-02-24 14:31:58', '647', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3064-3,');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 2363;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (647, '2022-02-24', 814.966555184, 840, 840
                    , 840, 840, 840, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+814.966555184, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 814.966555184, 840, 840
                    , 840, 840, 840, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+814.966555184, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , 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 = '61', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '3', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64.00', '61', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3080;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00660', '1131', '1', '660', '2', '220', '440', '0', '', '0', '2022-02-24 14:31:58', '660', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3080-2,');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 212.50, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 212.50
                where sellbilldetailid = 2364;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (660, '2022-02-24', 419.397993311, 440, 410
                    , 425, 410, 425, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+419.397993311, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+425
                            , 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, '2022-02-24', 419.397993311, 440, 410
                    , 425, 410, 425, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+419.397993311, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+425
                            , 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 = '44', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2080';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '7', '2', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '46.00', '44', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3016;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00671', '1131', '1', '671', '2', '180', '360', '0', '', '0', '2022-02-24 14:31:58', '671', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3016-2,');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2365;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (671, '2022-02-24', 343.143812709, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+343.143812709, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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, '2022-02-24', 343.143812709, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+343.143812709, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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 = '40', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2057';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '7', '2', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42.00', '40', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00638', '1131', '1', '638', '1', '185', '185', '0', '', '0', '2022-02-24 14:31:58', '638', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3032-1,');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (638, '2022-02-24', 176.337792642, 180, 180
                    , 180, 180, 180, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+176.337792642, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 176.337792642, 180, 180
                    , 180, 180, 180, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+176.337792642, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '63', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2061';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '7', '1', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64.00', '63', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3066;
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 ('165','00676', '1131', '1', '676', '1', '165', '165', '0', '', '0', '2022-02-24 14:31:58', '676', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3066-1,');
UPDATE sellbilldetail SET  lastbuyprice = 165.00 , meanbuyprice = 165.00, lastbuyprice_withDiscount = 165.00, meanbuyprice_withDiscount = 165.00
                where sellbilldetailid = 2367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (676, '2022-02-24', 157.274247492, 165, 165
                    , 165, 165, 165, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+157.274247492, sellCostBuyPrice =sellCostBuyPrice+165
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+165, sellCostMeanBuyPrice = sellCostMeanBuyPrice+165
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+165, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+165
                            , 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, '2022-02-24', 157.274247492, 165, 165
                    , 165, 165, 165, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+157.274247492, sellCostBuyPrice =sellCostBuyPrice+165
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+165, sellCostMeanBuyPrice = sellCostMeanBuyPrice+165
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+165, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+165
                            , 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 = '59', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2074';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '7', '1', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60.00', '59', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3020;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('145','00674', '1131', '1', '674', '1', '145', '145', '0', '', '0', '2022-02-24 14:31:58', '674', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3020-1,');
UPDATE sellbilldetail SET  lastbuyprice = 145.00 , meanbuyprice = 145.00, lastbuyprice_withDiscount = 145.00, meanbuyprice_withDiscount = 145.00
                where sellbilldetailid = 2368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (674, '2022-02-24', 138.210702341, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+138.210702341, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 138.210702341, 145, 145
                    , 145, 145, 145, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+138.210702341, sellCostBuyPrice =sellCostBuyPrice+145
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+145, sellCostMeanBuyPrice = sellCostMeanBuyPrice+145
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+145, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+145
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '55', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2059';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '7', '1', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56.00', '55', '4', '2022-02-24 14:31:58','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3030;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00637', '1131', '1', '637', '1', '190', '190', '0', '', '0', '2022-02-24 14:31:58', '637', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3030-1,');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 2369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (637, '2022-02-24', 181.10367893, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181.10367893, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 181.10367893, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181.10367893, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '75', userid = '4', storedetaildate = '2022-02-24 14:31:58' WHERE storedetailid = '2060';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '7', '1', '1', '1131', 'اضافة فاتورة مبيعات', 'sellbillController.php', '76.00', '75', '4', '2022-02-24 14:31:58','0','0');
UPDATE save SET  savecurrentvalue = '6940',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4090.00','2850', '0', '7', 'اضافة فاتورة مبيعات', '1131', '6940', '2022-02-24 14:31:58', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 2850, 2915, 2885
                    , 2900, 2885, 2900, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2915
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2885, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2885, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , 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, '2022-02-24', 2850, 2915, 2885
                    , 2900, 2885, 2900, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2850, sellCostBuyPrice =sellCostBuyPrice+2915
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2885, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2885, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , 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, 2850, 2915, 2885
                    , 2900, 2885, 2900, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2850, netSellCostBuyPrice = netSellCostBuyPrice+2915
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2885
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2900
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2885
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2900
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 062177a094b55b and sellbillId = 1131 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:01:58";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:31:58", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:31:58', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:03:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:33:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:33:08', '1', 'add', '156.210.120.130', '', '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(260,1,3,749,50,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 14:33:08',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2168';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 749, 0, 0
                    , 145.00, -50, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "50*2022-02-24*145.00," WHERE transferproductid = 1668;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('749', '1', '50', '1', '1668', 'تحويل منتجات من المخزن', 'storemovementController.php', '50.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('749', '3', '50', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 749, 0, 0
                    , 145.00, 50, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('749', '3', '50', '0', '1668', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '50', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '750', '20', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2169';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 750, 0, 0
                    , 160.00, -20, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*160.00," WHERE transferproductid = 1669;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('750', '1', '20', '1', '1669', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('750', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 750, 0, 0
                    , 160.00, 20, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('750', '3', '20', '0', '1669', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '751', '30', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2170';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 751, 0, 0
                    , 160.00, -30, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*160.00," WHERE transferproductid = 1670;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('751', '1', '30', '1', '1670', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('751', '3', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 751, 0, 0
                    , 160.00, 30, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('751', '3', '30', '0', '1670', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '752', '20', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2171';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 752, 0, 0
                    , 160.00, -20, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*160.00," WHERE transferproductid = 1671;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('752', '1', '20', '1', '1671', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('752', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 752, 0, 0
                    , 160.00, 20, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('752', '3', '20', '0', '1671', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '753', '40', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2172';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 753, 0, 0
                    , 165.00, -40, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "40*2022-02-24*165.00," WHERE transferproductid = 1672;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('753', '1', '40', '1', '1672', 'تحويل منتجات من المخزن', 'storemovementController.php', '40.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('753', '3', '40', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 753, 0, 0
                    , 165.00, 40, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('753', '3', '40', '0', '1672', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '40', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '754', '25', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2173';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 754, 0, 0
                    , 185.00, -25, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "25*2022-02-24*185.00," WHERE transferproductid = 1673;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('754', '1', '25', '1', '1673', 'تحويل منتجات من المخزن', 'storemovementController.php', '25.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('754', '3', '25', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 754, 0, 0
                    , 185.00, 25, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('754', '3', '25', '0', '1673', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '25', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '755', '30', '2022-02-24', '1', '0','260',null,null,'2022-02-24 14:33:08',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2174';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 755, 0, 0
                    , 165.00, -30, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*165.00," WHERE transferproductid = 1674;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('755', '1', '30', '1', '1674', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('755', '3', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 755, 0, 0
                    , 165.00, 30, 0, 0, 1, '2022-02-24 14:33:08')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 14:33:08' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('755', '3', '30', '0', '1674', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:03:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:33:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 14:33:08', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:05:17";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:35:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:35:17', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 062177abea5d9b
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 14:31:58', '062177abea5d9b', '1', '0.00', '0', '80', '1', '2380', '2300', '2300', '0', '7', '2022-02-24 14:35:17', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '16' ,'0','','','','','-1','0','0','0','0','0','2300','0','','0','0','2300','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','اضافة فاتورة مبيعات','1132', '0', '2022-02-24 14:35:17', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2300', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3160;
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 ('150','00741', '1132', '1', '741', '2', '150.00', '300', '0', '', '0', '2022-02-24 14:35:17', '741', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3160-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2370;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (741, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '22', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('741', '7', '2', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24.00', '22', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3164;
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 ('150','00743', '1132', '1', '743', '2', '150', '300', '0', '', '0', '2022-02-24 14:35:17', '743', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3164-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2371;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (743, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '18', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2162';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('743', '7', '2', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20.00', '18', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3158;
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 ('135','00740', '1132', '1', '740', '3', '135', '405', '0', '', '0', '2022-02-24 14:35:17', '740', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3158-3,');
UPDATE sellbilldetail SET  lastbuyprice = 135.00 , meanbuyprice = 135.00, lastbuyprice_withDiscount = 135.00, meanbuyprice_withDiscount = 135.00
                where sellbilldetailid = 2372;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (740, '2022-02-24', 391.386554622, 405, 405
                    , 405, 405, 405, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+391.386554622, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 391.386554622, 405, 405
                    , 405, 405, 405, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+391.386554622, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '47', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2159';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('740', '7', '3', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50.00', '47', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3162;
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 ('150','00742', '1132', '1', '742', '2', '150', '300', '0', '', '0', '2022-02-24 14:35:17', '742', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3162-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2373;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (742, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '27', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2161';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('742', '7', '2', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29.00', '27', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3170;
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 ('155','00746', '1132', '1', '746', '2', '155', '310', '0', '', '0', '2022-02-24 14:35:17', '746', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3170-2,');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2374;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (746, '2022-02-24', 299.579831933, 310, 310
                    , 310, 310, 310, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+299.579831933, sellCostBuyPrice =sellCostBuyPrice+310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+310, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+310
                            , 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, '2022-02-24', 299.579831933, 310, 310
                    , 310, 310, 310, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+299.579831933, sellCostBuyPrice =sellCostBuyPrice+310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+310, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+310
                            , 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 = '25', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '7', '2', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27.00', '25', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3164;
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 ('150','00743', '1132', '1', '743', '2', '150', '300', '0', '', '0', '2022-02-24 14:35:17', '743', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3164-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2375;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (743, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 289.915966387, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+289.915966387, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '16', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2162';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('743', '7', '2', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '16', '4', '2022-02-24 14:35:17','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3166;
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 ('155','00744', '1132', '1', '744', '3', '155', '465', '0', '', '0', '2022-02-24 14:35:17', '744', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3166-3,');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (744, '2022-02-24', 449.369747899, 465, 465
                    , 465, 465, 465, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+449.369747899, sellCostBuyPrice =sellCostBuyPrice+465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+465
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 449.369747899, 465, 465
                    , 465, 465, 465, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+449.369747899, sellCostBuyPrice =sellCostBuyPrice+465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+465
                            , 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 = '37', userid = '4', storedetaildate = '2022-02-24 14:35:17' WHERE storedetailid = '2163';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('744', '7', '3', '1', '1132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40.00', '37', '4', '2022-02-24 14:35:17','0','0');
UPDATE save SET  savecurrentvalue = '9240',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('6940.00','2300', '0', '7', 'اضافة فاتورة مبيعات', '1132', '9240', '2022-02-24 14:35:17', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 2300, 2380, 2380
                    , 2380, 2380, 2380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, sellCostBuyPrice =sellCostBuyPrice+2380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2380
                            , 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, '2022-02-24', 2300, 2380, 2380
                    , 2380, 2380, 2380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, sellCostBuyPrice =sellCostBuyPrice+2380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2380
                            , 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, 2300, 2380, 2380
                    , 2380, 2380, 2380, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2300, netSellCostBuyPrice = netSellCostBuyPrice+2380
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2380
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2380
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2380
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2380
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 062177abea5d9b and sellbillId = 1132 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:05:17";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:35:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:35:17', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:05:22";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:35:22", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:35:22', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:07:00";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:37:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 14:37:01', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:07:45";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:37:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 14:37:45', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '77.00', '78', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:07:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 14:37:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 14:37:47', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:08:07";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:38:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:38:07', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 062177b8ad14a0
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 14:35:22', '062177b8ad14a0', '1', '0.00', '0', '50', '1', '2255', '2205', '2205', '0', '7', '2022-02-24 14:38:07', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '13' ,'0','','','','','-1','0','0','0','0','0','2205','0','','0','0','2205','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','اضافة فاتورة مبيعات','1133', '0', '2022-02-24 14:38:07', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2205', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3152;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00735', '1133', '1', '735', '2', '180.00', '360', '0', '', '0', '2022-02-24 14:38:07', '735', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3152-2,');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2377;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (735, '2022-02-24', 352.017738359, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.017738359, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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, '2022-02-24', 352.017738359, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+352.017738359, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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 = '18', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2147';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('735', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20.00', '18', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3142;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00730', '1133', '1', '730', '2', '205', '410', '0', '', '0', '2022-02-24 14:38:07', '730', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3142-2,');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2378;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (730, '2022-02-24', 400.909090909, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400.909090909, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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, '2022-02-24', 400.909090909, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400.909090909, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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 = '26', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2142';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('730', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28.00', '26', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3148;
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 ('150','00733', '1133', '1', '733', '2', '150', '300', '0', '', '0', '2022-02-24 14:38:07', '733', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3148-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2379;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (733, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '22', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2145';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('733', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24.00', '22', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3150;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00734', '1133', '1', '734', '2', '205', '410', '0', '', '0', '2022-02-24 14:38:07', '734', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3150-2,');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2380;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (734, '2022-02-24', 400.909090909, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400.909090909, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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, '2022-02-24', 400.909090909, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400.909090909, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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 = '14', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('734', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16.00', '14', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3086;
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 ('150','00704', '1133', '1', '704', '2', '150', '300', '0', '', '0', '2022-02-24 14:38:07', '704', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3086-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2381;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (704, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '16', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('704', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '16', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3088;
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 ('150','00706', '1133', '1', '706', '2', '150', '300', '0', '', '0', '2022-02-24 14:38:07', '706', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3088-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2382;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (706, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 293.348115299, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+293.348115299, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '16', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('706', '7', '2', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '16', '4', '2022-02-24 14:38:07','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3098;
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 ('175','00716', '1133', '1', '716', '1', '175', '175', '0', '', '0', '2022-02-24 14:38:07', '716', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3098-1,');
UPDATE sellbilldetail SET  lastbuyprice = 175.00 , meanbuyprice = 175.00, lastbuyprice_withDiscount = 175.00, meanbuyprice_withDiscount = 175.00
                where sellbilldetailid = 2383;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (716, '2022-02-24', 171.119733925, 175, 175
                    , 175, 175, 175, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+171.119733925, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+175
                            , 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, '2022-02-24', 171.119733925, 175, 175
                    , 175, 175, 175, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+171.119733925, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '17', userid = '4', storedetaildate = '2022-02-24 14:38:07' WHERE storedetailid = '2108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('716', '7', '1', '1', '1133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '17', '4', '2022-02-24 14:38:07','0','0');
UPDATE save SET  savecurrentvalue = '11445',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('9240.00','2205', '0', '7', 'اضافة فاتورة مبيعات', '1133', '11445', '2022-02-24 14:38:07', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 2205, 2255, 2255
                    , 2255, 2255, 2255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2205, sellCostBuyPrice =sellCostBuyPrice+2255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2255
                            , 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, '2022-02-24', 2205, 2255, 2255
                    , 2255, 2255, 2255, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2205, sellCostBuyPrice =sellCostBuyPrice+2255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2255
                            , 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, 2205, 2255, 2255
                    , 2255, 2255, 2255, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2205, netSellCostBuyPrice = netSellCostBuyPrice+2255
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2255
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2255
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2255
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2255
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 062177b8ad14a0 and sellbillId = 1133 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:08:07";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:38:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:38:07', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:08:13";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:38:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:38:13', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:08:24";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:38:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 14:38:24', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:08:45";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:38:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 14:38:45', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:09:32";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:39:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 14:39:33', '4', 'add', '41.232.89.131', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'حجات لشيخ وليد', '', '2145', '2022-02-24', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '9300',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('11445.00','2145', '1', '7', 'إضافة مصروف', '399', '9300', '2022-02-24 14:39:33', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2145', '2145', '2022-02-24', '4', '0', '0', '2022-02-24 14:39:33','اضافة اسم مصروف( حجات لشيخ وليد )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1554', '160', '2145', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-85765', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1554', '141', '2145', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-110990', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'حجات لشيخ وليد', expensesdetails = '', expensesValue = '2145.00', expensesdate = '2022-02-24', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '1554', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '399';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:09:33";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:39:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 14:39:33', '4', 'sucess', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:09:35";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:39:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 14:39:35', '4', 'show', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:09:36";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:39:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 14:39:36', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:11:29";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:41:29", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:41:29', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:11:31";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:41:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 14:41:31', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:11:38";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 14:41:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 14:41:38', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 11:41:53";
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 < "2022-02-24 11:43:10";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 15:13:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 15:13:10', '5', '', '197.55.81.24', '', '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 < "2022-02-24 11:43: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 < "2022-02-24 11:43:13";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 15:13:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:13:13', '5', 'addsellBill', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:03:32";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 15:33:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:33:32', '1', 'addsellBill', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:03:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 15:33:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 15:33:48', '1', '', '156.210.120.130', '', '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 < "2022-02-24 12:10:04";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 15:40:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 15:40:04', '7', '', '197.192.234.56', '', '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 < "2022-02-24 12:10:05";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:10:50";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 15:40:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:40:50', '7', 'addsellBill', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:11:55";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:41:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:41:55', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid) VALUES ('ام منار' , '', '', '', '0', '', '0', '2022-02-24 15:42:24', '4', '0','','0','','-10','0','10000',',-20,','-1','0','.','1','10','.','2022-02-24','0','0','','0','0','0');
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('106', '0', '0', '', '');
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 ('106','0','0','0','إضافة عميل جديد','106', '0', '2022-02-24 15:42:24', '4', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO accountstree (name, customName, parent, itemtype, itemfrom, notes, del, userid, mydate, itemtype2, theValue, theOrder, layingOrder,reportid) VALUES ('ام منار', 'ام منار', '23', '3', '0', '', '0', '4', '2022-02-24', '1', '0', '0', '','2');
UPDATE client SET clientname = 'ام منار', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2022-02-24', userid = '4'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',-20,',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '1',specialDiscountVal = '10',file = '.',mandobCollectRatio='0',clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0' WHERE clientid = '106';
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:12:49";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:42:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:42:49', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:12:49";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:42:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:42:49', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:20:07";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 15:50:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 15:50:07', '7', '', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:20:12";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:50:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:50:12', '4', 'addAndRetuen', '41.232.89.131', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 062178b59e20da
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(106,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2022-02-24 15:42:49', '062178b59e20da', '106', '0.00', '1850', '325', '1', '8775', '8450', '6600', '1850', '7', '2022-02-24 15:50:12', '', '4', '0', 'ام منار', '7', '1', '3', '0', 'ام منار', '47' ,'0','','','','','-1','0','0','0','0','0','8450','0','','0','0','6600','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '1850', userid = '4' WHERE clientid = '106';
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 ('106','0.00','1850','0','اضافة فاتورة مبيعات','1134', '1850', '2022-02-24 15:50:12', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8450', '0', null, '0', null, null,'', '0','1','1','1850','1');
UPDATE client SET  inUse = 0 where clientid = 106;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 2858;
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 ('190','00683', '1134', '1', '683', '2', '190.00', '380', '0', '', '0', '2022-02-24 15:50:12', '683', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2858-2,');
UPDATE sellbilldetail SET  lastbuyprice = 190.00 , meanbuyprice = 190.00, lastbuyprice_withDiscount = 190.00, meanbuyprice_withDiscount = 190.00
                where sellbilldetailid = 2384;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (683, '2022-02-24', 365.925925926, 380, 380
                    , 380, 380, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+365.925925926, sellCostBuyPrice =sellCostBuyPrice+380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , 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, '2022-02-24', 365.925925926, 380, 380
                    , 380, 380, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+365.925925926, sellCostBuyPrice =sellCostBuyPrice+380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '22', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '1978';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('683', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24.00', '22', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 2874;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('240','00691', '1134', '1', '691', '3', '240', '720', '0', '', '0', '2022-02-24 15:50:12', '691', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','2874-3,');
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
                where sellbilldetailid = 2385;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (691, '2022-02-24', 693.333333333, 720, 720
                    , 720, 720, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+693.333333333, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 693.333333333, 720, 720
                    , 720, 720, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+693.333333333, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '17', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '1986';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('691', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20.00', '17', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3036;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('180','00669', '1134', '1', '669', '2', '180', '360', '0', '', '0', '2022-02-24 15:50:12', '669', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3036-2,');
UPDATE sellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 2386;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (669, '2022-02-24', 346.666666667, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+346.666666667, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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, '2022-02-24', 346.666666667, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+346.666666667, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , 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 = '62', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2062';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64.00', '62', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3066;
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 ('165','00676', '1134', '1', '676', '3', '165', '495', '0', '', '0', '2022-02-24 15:50:12', '676', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3066-3,');
UPDATE sellbilldetail SET  lastbuyprice = 165.00 , meanbuyprice = 165.00, lastbuyprice_withDiscount = 165.00, meanbuyprice_withDiscount = 165.00
                where sellbilldetailid = 2387;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (676, '2022-02-24', 476.666666667, 495, 495
                    , 495, 495, 495, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+476.666666667, sellCostBuyPrice =sellCostBuyPrice+495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+495, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+495
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 476.666666667, 495, 495
                    , 495, 495, 495, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+476.666666667, sellCostBuyPrice =sellCostBuyPrice+495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+495, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+495
                            , 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 = '56', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2074';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59.00', '56', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 3064;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('280','00647', '1134', '1', '647', '4', '285', '1140', '0', '', '0', '2022-02-24 15:50:12', '647', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3064-4,');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 2388;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (647, '2022-02-24', 1097.77777778, 1120, 1120
                    , 1120, 1120, 1120, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1097.77777778, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , 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+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 1097.77777778, 1120, 1120
                    , 1120, 1120, 1120, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1097.77777778, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '57', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '7', '4', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '61.00', '57', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 3014;
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','00572', '1134', '1', '572', '4', '200', '800', '0', '', '0', '2022-02-24 15:50:12', '572', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3014-4,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2389;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (572, '2022-02-24', 770.37037037, 800, 840
                    , 820, 840, 820, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+770.37037037, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+820
                            , 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+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 770.37037037, 800, 840
                    , 820, 840, 820, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+770.37037037, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+820
                            , 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 = '61', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2056';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '7', '4', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '65.00', '61', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3030;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00637', '1134', '1', '637', '3', '190', '570', '0', '', '0', '2022-02-24 15:50:12', '637', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3030-3,');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 2390;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (637, '2022-02-24', 548.888888889, 555, 555
                    , 555, 555, 555, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+548.888888889, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 548.888888889, 555, 555
                    , 555, 555, 555, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+548.888888889, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , 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 = '72', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2060';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75.00', '72', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3094;
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 ('150','00712', '1134', '1', '712', '3', '150', '450', '0', '', '0', '2022-02-24 15:50:12', '712', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3094-3,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2391;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (712, '2022-02-24', 433.333333333, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+433.333333333, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 433.333333333, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+433.333333333, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , 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 = '15', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2106';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('712', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '15', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 3102;
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 ('150','00720', '1134', '1', '720', '4', '150', '600', '0', '', '0', '2022-02-24 15:50:12', '720', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3102-4,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2392;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (720, '2022-02-24', 577.777777778, 600, 600
                    , 600, 600, 600, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+577.777777778, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , 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+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 577.777777778, 600, 600
                    , 600, 600, 600, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+577.777777778, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , 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 = '14', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('720', '7', '4', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '14', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3154;
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 ('150','00736', '1134', '1', '736', '3', '150', '450', '0', '', '0', '2022-02-24 15:50:12', '736', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3154-3,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2393;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (736, '2022-02-24', 433.333333333, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+433.333333333, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 433.333333333, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+433.333333333, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , 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 = '15', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2148';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('736', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18.00', '15', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 3156;
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 ('195','00737', '1134', '1', '737', '5', '195', '975', '0', '', '0', '2022-02-24 15:50:12', '737', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3156-5,');
UPDATE sellbilldetail SET  lastbuyprice = 195.00 , meanbuyprice = 195.00, lastbuyprice_withDiscount = 195.00, meanbuyprice_withDiscount = 195.00
                where sellbilldetailid = 2394;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (737, '2022-02-24', 938.888888889, 975, 975
                    , 975, 975, 975, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+938.888888889, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+975
                            , 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+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 938.888888889, 975, 975
                    , 975, 975, 975, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+938.888888889, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+975
                            , 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 = '15', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2149';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('737', '7', '5', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20.00', '15', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3144;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00731', '1134', '1', '731', '2', '205', '410', '0', '', '0', '2022-02-24 15:50:12', '731', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3144-2,');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2395;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (731, '2022-02-24', 394.814814815, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+394.814814815, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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, '2022-02-24', 394.814814815, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+394.814814815, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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 = '18', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2143';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('731', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20.00', '18', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3142;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('205','00730', '1134', '1', '730', '2', '205', '410', '0', '', '0', '2022-02-24 15:50:12', '730', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3142-2,');
UPDATE sellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where sellbilldetailid = 2396;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (730, '2022-02-24', 394.814814815, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+394.814814815, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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, '2022-02-24', 394.814814815, 410, 410
                    , 410, 410, 410, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+394.814814815, sellCostBuyPrice =sellCostBuyPrice+410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+410
                            , 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 = '24', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2142';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('730', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26.00', '24', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3148;
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 ('150','00733', '1134', '1', '733', '2', '150', '300', '0', '', '0', '2022-02-24 15:50:12', '733', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3148-2,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2397;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (733, '2022-02-24', 288.888888889, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+288.888888889, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2022-02-24', 288.888888889, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+288.888888889, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '20', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2145';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('733', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '22.00', '20', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 3158;
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 ('135','00740', '1134', '1', '740', '3', '135', '405', '0', '', '0', '2022-02-24 15:50:12', '740', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3158-3,');
UPDATE sellbilldetail SET  lastbuyprice = 135.00 , meanbuyprice = 135.00, lastbuyprice_withDiscount = 135.00, meanbuyprice_withDiscount = 135.00
                where sellbilldetailid = 2398;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (740, '2022-02-24', 390, 405, 405
                    , 405, 405, 405, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+390, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2022-02-24', 390, 405, 405
                    , 405, 405, 405, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+390, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , 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 = '44', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2159';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('740', '7', '3', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '47.00', '44', '4', '2022-02-24 15:50:12','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 3170;
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 ('155','00746', '1134', '1', '746', '2', '155', '310', '0', '', '0', '2022-02-24 15:50:12', '746', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','3170-2,');
UPDATE sellbilldetail SET  lastbuyprice = 155.00 , meanbuyprice = 155.00, lastbuyprice_withDiscount = 155.00, meanbuyprice_withDiscount = 155.00
                where sellbilldetailid = 2399;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (746, '2022-02-24', 298.518518519, 310, 310
                    , 310, 310, 310, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+298.518518519, sellCostBuyPrice =sellCostBuyPrice+310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+310, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+310
                            , 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, '2022-02-24', 298.518518519, 310, 310
                    , 310, 310, 310, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+298.518518519, sellCostBuyPrice =sellCostBuyPrice+310
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+310, sellCostMeanBuyPrice = sellCostMeanBuyPrice+310
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+310, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+310
                            , 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 = '23', userid = '4', storedetaildate = '2022-02-24 15:50:12' WHERE storedetailid = '2165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('746', '7', '2', '1', '1134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25.00', '23', '4', '2022-02-24 15:50:12','0','0');
UPDATE save SET  savecurrentvalue = '15900',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('9300.00','6600', '0', '7', 'اضافة فاتورة مبيعات', '1134', '15900', '2022-02-24 15:50:12', '4',  'sellbillController.php','106','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 8450, 8740, 8780
                    , 8760, 8780, 8760, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8450, sellCostBuyPrice =sellCostBuyPrice+8740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8760
                            , 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 (106, '2022-02-24', 8450, 8740, 8780
                    , 8760, 8780, 8760, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8450, sellCostBuyPrice =sellCostBuyPrice+8740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8760
                            , 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, 8450, 8740, 8780
                    , 8760, 8780, 8760, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8450, netSellCostBuyPrice = netSellCostBuyPrice+8740
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8760
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8780
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8760
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 062178b59e20da and sellbillId = 1134 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:20:13";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:50:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 15:50:13', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:20:17";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 15:50:17", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 15:50:17', '7', 'show', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:20:19";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:50:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 15:50:19', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:21:15";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 15:51:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 15:51:15', '7', 'show', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:21:37";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:51:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:51:37', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:22";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:22", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:22', '4', 'add', '41.232.89.131', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'العميد قبض', '', '700', '2022-02-24', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '15200',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('15900.00','700', '1', '7', 'إضافة مصروف', '400', '15200', '2022-02-24 15:52:22', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '700', '700', '2022-02-24', '4', '0', '0', '2022-02-24 15:52:22','اضافة اسم مصروف( العميد قبض )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1555', '160', '700', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-86465', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1555', '141', '700', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-111690', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'العميد قبض', expensesdetails = '', expensesValue = '700.00', expensesdate = '2022-02-24', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '1555', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '400';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:22";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:22", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:23', '4', 'sucess', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:24";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:24', '4', 'show', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:26";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 15:52:26', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:31";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:31', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:45";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:45', '4', 'add', '41.232.89.131', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'العجوز قبض', '', '700', '2022-02-24', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '14500',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('15200.00','700', '1', '7', 'إضافة مصروف', '401', '14500', '2022-02-24 15:52:45', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '700', '700', '2022-02-24', '4', '0', '0', '2022-02-24 15:52:45','اضافة اسم مصروف( العجوز قبض )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1556', '160', '700', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-87165', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1556', '141', '700', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-112390', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'العجوز قبض', expensesdetails = '', expensesValue = '700.00', expensesdate = '2022-02-24', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '1556', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '401';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:45";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:46', '4', 'sucess', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:47";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:47", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:47', '4', 'show', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:49";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2022-02-24 15:52:49', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:22:52";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:52:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:52:53', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:23:50";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:53:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:53:50', '4', 'add', '41.232.89.131', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'نسبه العجوز والعميد', '', '370', '2022-02-24', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '14130',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14500.00','370', '1', '7', 'إضافة مصروف', '402', '14130', '2022-02-24 15:53:50', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '370', '370', '2022-02-24', '4', '0', '0', '2022-02-24 15:53:50','اضافة اسم مصروف( نسبه العجوز والعميد )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1557', '160', '370', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-87535', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1557', '141', '370', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-112760', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'نسبه العجوز والعميد', expensesdetails = '', expensesValue = '370.00', expensesdate = '2022-02-24', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '1557', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '402';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:23:51";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:53:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:53:51', '4', 'sucess', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:23:52";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:53:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:53:52', '4', 'show', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:23:54";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 15:53:54", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 15:53:54', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:29:40";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 15:59:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 15:59:40', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:30:07";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:00:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:00:07', '5', 'add', '197.55.81.24', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('6', 'اكياس', '', '30', '2022-02-24', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '370',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('400.00','30', '1', '3', 'إضافة مصروف', '403', '370', '2022-02-24 16:00:07', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '30', '30', '2022-02-24', '5', '0', '0', '2022-02-24 16:00:07','اضافة اسم مصروف( اكياس )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1558', '149', '30', '','0');
UPDATE accountstree SET name = 'ادوات مكتبية', customName = 'ادوات مكتبية', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '3572', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '149';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1558', '137', '30', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-62880', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '137';
UPDATE expenses SET expensestypeid = '6', expensesname = 'اكياس', expensesdetails = '', expensesValue = '30.00', expensesdate = '2022-02-24', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '1558', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '403';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:30:08";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:00:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:00:08', '5', 'sucess', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:30:10";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:00:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:00:10', '5', 'show', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:32:51";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:02:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:02:51', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:33:17";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:03:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:03:17', '4', 'add', '41.232.89.131', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'تروسكل شغل ادم', '', '20', '2022-02-24', '4', '0','-1','7','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '14110',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14130.00','20', '1', '7', 'إضافة مصروف', '404', '14110', '2022-02-24 16:03:17', '4',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '20', '20', '2022-02-24', '4', '0', '0', '2022-02-24 16:03:17','اضافة اسم مصروف( تروسكل شغل ادم )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1559', '160', '20', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-87555', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1559', '141', '20', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-112780', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'تروسكل شغل ادم', expensesdetails = '', expensesValue = '20.00', expensesdate = '2022-02-24', userid = '4', conditions = '0',saveid = '7' , dailyentryid = '1559', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '404';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:33:17";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:03:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:03:18', '4', 'sucess', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:33:19";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:03:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:03:19', '4', 'show', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:33:19";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:03:19", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:03:19', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:34:58";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:04:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:04:58', '5', 'addsellBill', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:40:40";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:10:40", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:10:40', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:41:51";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:11:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:11:52', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:43:43";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:13:43", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:13:43', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:50:42";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:20:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:20:42', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:55:49";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:25:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:25:49', '5', 'add', '197.55.81.24', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('6', 'لزق واكياس', '', '105', '2022-02-24', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '265',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('370.00','105', '1', '3', 'إضافة مصروف', '405', '265', '2022-02-24 16:25:49', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '105', '105', '2022-02-24', '5', '0', '0', '2022-02-24 16:25:49','اضافة اسم مصروف( لزق واكياس )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1560', '149', '105', '','0');
UPDATE accountstree SET name = 'ادوات مكتبية', customName = 'ادوات مكتبية', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '3677', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '149';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1560', '137', '105', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-62985', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '137';
UPDATE expenses SET expensestypeid = '6', expensesname = 'لزق واكياس', expensesdetails = '', expensesValue = '105.00', expensesdate = '2022-02-24', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '1560', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '405';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:55:49";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:25:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:25:49', '5', 'sucess', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:55:51";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:25:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:25:51', '5', 'show', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:55:52";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:25:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:25:52', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:56:35";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:26:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 16:26:35', '1', 'add', '156.210.120.130', '', '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 ('ادم8815 الاسكندرية','','1','215','215', '255','225', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '215','215','215','215','215','0','0','4.65','18.6','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8815 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215', productSellAllPrice = '215', productSellUnitPrice = '255', productSellHalfPrice = '225', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00756',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '756';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '756', '1', '2022-02-24', '1', '0','0075601','215','225','255','215');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('756', '1', '28', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('756', '1', '28', '0', '756', 'إضافة منتج', 'productController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (756, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 756, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6020', '6020', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم8815 الاسكندرية الكمية 28','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1561', '19', '6020', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6746574.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1561', '7', '6020', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7598275.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8815 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215.00', productSellAllPrice = '215.00', productSellUnitPrice = '255.00', productSellHalfPrice = '225.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00756',type ='0', expireDate = '0' , dailyentryId = '1561',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '756';
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 ('ادم8010 الاسكندرية','','1','215','215', '255','225', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '215','215','215','215','215','0','0','4.65','18.6','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8010 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215', productSellAllPrice = '215', productSellUnitPrice = '255', productSellHalfPrice = '225', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00757',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '757';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '757', '1', '2022-02-24', '1', '0','0075701','215','225','255','215');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('757', '1', '24', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('757', '1', '24', '0', '757', 'إضافة منتج', 'productController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (757, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 757, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '5160', '5160', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم8010 الاسكندرية الكمية 24','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1562', '19', '5160', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6751734.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1562', '7', '5160', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7603435.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8010 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215.00', productSellAllPrice = '215.00', productSellUnitPrice = '255.00', productSellHalfPrice = '225.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00757',type ='0', expireDate = '0' , dailyentryId = '1562',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '757';
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 ('ادم8012 الاسكندرية','','1','215','215', '255','225', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '215','215','215','215','215','0','0','4.65','18.6','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8012 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215', productSellAllPrice = '215', productSellUnitPrice = '255', productSellHalfPrice = '225', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00758',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '758';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '758', '1', '2022-02-24', '1', '0','0075801','215','225','255','215');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('758', '1', '28', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('758', '1', '28', '0', '758', 'إضافة منتج', 'productController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (758, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 758, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6020', '6020', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم8012 الاسكندرية الكمية 28','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1563', '19', '6020', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6757754.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1563', '7', '6020', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7609455.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8012 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215.00', productSellAllPrice = '215.00', productSellUnitPrice = '255.00', productSellHalfPrice = '225.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00758',type ='0', expireDate = '0' , dailyentryId = '1563',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '758';
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 ('ادم3020 الاسكندرية','','1','190','190', '230','200', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '190','190','190','190','190','0','0','5.26','21.05','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3020 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '190', productSellAllPrice = '190', productSellUnitPrice = '230', productSellHalfPrice = '200', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00759',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '759';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '759', '1', '2022-02-24', '1', '0','0075901','190','200','230','190');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('759', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('759', '1', '20', '0', '759', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (759, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 759, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3800', '3800', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم3020 الاسكندرية الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1564', '19', '3800', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6761554.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1564', '7', '3800', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7613255.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3020 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '190.00', productSellUnitPrice = '230.00', productSellHalfPrice = '200.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00759',type ='0', expireDate = '0' , dailyentryId = '1564',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '759';
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 ('ادم8035 الاسكندرية','','1','215','215', '255','225', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '215','215','215','215','215','0','0','4.65','18.6','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم8035 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215', productSellAllPrice = '215', productSellUnitPrice = '255', productSellHalfPrice = '225', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00760',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '760';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '760', '1', '2022-02-24', '1', '0','0076001','215','225','255','215');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('760', '1', '22', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('760', '1', '22', '0', '760', 'إضافة منتج', 'productController.php', '0', '22', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (760, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 760, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4730', '4730', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم8035 الاسكندرية الكمية 22','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1565', '19', '4730', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6766284.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1565', '7', '4730', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7617985.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم8035 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '215.00', productSellAllPrice = '215.00', productSellUnitPrice = '255.00', productSellHalfPrice = '225.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00760',type ='0', expireDate = '0' , dailyentryId = '1565',isService = '0',isOptic = '0',lastbuyprice = '215',lastbuyprice_withDiscount = '215',meanbuyprice = '215',meanbuyprice_withDiscount = '215' , productbuypricereal = '215' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '18.6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '760';
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 ('ادم3025 الاسكندرية','','1','190','190', '230','200', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '190','190','190','190','190','0','0','5.26','21.05','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3025 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '190', productSellAllPrice = '190', productSellUnitPrice = '230', productSellHalfPrice = '200', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00761',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '761';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '761', '1', '2022-02-24', '1', '0','0076101','190','200','230','190');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('761', '1', '20', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('761', '1', '20', '0', '761', 'إضافة منتج', 'productController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (761, 1,'2022-02-24 16:26:35',1)
                ON DUPLICATE KEY UPDATE productid = 761, edited = 1, sysdate = '2022-02-24 16:26:35', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3800', '3800', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:35','إضافة منتج ادم3025 الاسكندرية الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1566', '19', '3800', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6770084.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1566', '7', '3800', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7621785.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3025 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '190.00', productSellUnitPrice = '230.00', productSellHalfPrice = '200.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00761',type ='0', expireDate = '0' , dailyentryId = '1566',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '761';
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 ('ادم3005 الاسكندرية','','1','170','170', '210','180', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '170','170','170','170','170','0','0','5.88','23.53','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم3005 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '170', productSellAllPrice = '170', productSellUnitPrice = '210', productSellHalfPrice = '180', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00762',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '170',lastbuyprice_withDiscount = '170',meanbuyprice = '170',meanbuyprice_withDiscount = '170' , productbuypricereal = '170' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.88' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '762';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '762', '1', '2022-02-24', '1', '0','0076201','170','180','210','170');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('762', '1', '24', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('762', '1', '24', '0', '762', 'إضافة منتج', 'productController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (762, 1,'2022-02-24 16:26:36',1)
                ON DUPLICATE KEY UPDATE productid = 762, edited = 1, sysdate = '2022-02-24 16:26:36', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '4080', '4080', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:36','إضافة منتج ادم3005 الاسكندرية الكمية 24','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1567', '19', '4080', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6774164.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1567', '7', '4080', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7625865.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم3005 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '170.00', productSellAllPrice = '170.00', productSellUnitPrice = '210.00', productSellHalfPrice = '180.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00762',type ='0', expireDate = '0' , dailyentryId = '1567',isService = '0',isOptic = '0',lastbuyprice = '170',lastbuyprice_withDiscount = '170',meanbuyprice = '170',meanbuyprice_withDiscount = '170' , productbuypricereal = '170' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.88' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '762';
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 ('ادم4041 الاسكندرية','','1','160','160', '200','170', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '160','160','160','160','160','0','0','6.25','25','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ادم4041 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160', productSellAllPrice = '160', productSellUnitPrice = '200', productSellHalfPrice = '170', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00763',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '763';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '763', '1', '2022-02-24', '1', '0','0076301','160','170','200','160');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('763', '1', '18', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('763', '1', '18', '0', '763', 'إضافة منتج', 'productController.php', '0', '18', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (763, 1,'2022-02-24 16:26:36',1)
                ON DUPLICATE KEY UPDATE productid = 763, edited = 1, sysdate = '2022-02-24 16:26:36', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2880', '2880', '2022-02-24', '1', '0', '0', '2022-02-24 16:26:36','إضافة منتج ادم4041 الاسكندرية الكمية 18','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1568', '19', '2880', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6777044.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1568', '7', '2880', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7628745.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ادم4041 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160.00', productSellAllPrice = '160.00', productSellUnitPrice = '200.00', productSellHalfPrice = '170.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00763',type ='0', expireDate = '0' , dailyentryId = '1568',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '763';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:56:37";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:26:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 16:26:37', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:56:44";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:26:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 16:26:44', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:58:12";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:28:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:28:12', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:58:31";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:28:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:28:31', '5', 'add', '197.55.81.24', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'روني', '', '150', '2022-02-24', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '115',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('265.00','150', '1', '3', 'إضافة مصروف', '406', '115', '2022-02-24 16:28:31', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '150', '150', '2022-02-24', '5', '0', '0', '2022-02-24 16:28:31','اضافة اسم مصروف( روني )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1569', '145', '150', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '69900', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1569', '137', '150', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-63135', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '137';
UPDATE expenses SET expensestypeid = '2', expensesname = 'روني', expensesdetails = '', expensesValue = '150.00', expensesdate = '2022-02-24', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '1569', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '406';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:58:32";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:28:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:28:32', '5', 'sucess', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:58:33";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:28:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:28:33', '5', 'show', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 12:58:34";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:28:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:28:34', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:02:25";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 16:32:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:32:25', '5', 'addsellBill', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:03:42";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 16:33:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:33:42', '7', 'addsellBill', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:03:49";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 16:33:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:33:49', '7', '', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:04:17";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 16:34:17", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:34:17', '7', '', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:04:20";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 16:34:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:34:20', '7', '', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:04:32";
UPDATE user SET loginip = "197.192.234.56", lastactivetime = "2022-02-24 16:34:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:34:32', '7', '', '197.192.234.56', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:06:34";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:36:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 16:36:34', '1', 'add', '156.210.120.130', '', '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(261,1,3,756,28,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 16:36:35',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2182';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 756, 0, 0
                    , 215.00, -28, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*215.00," WHERE transferproductid = 1675;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('756', '1', '28', '1', '1675', 'تحويل منتجات من المخزن', 'storemovementController.php', '28.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('756', '3', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 756, 0, 0
                    , 215.00, 28, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('756', '3', '28', '0', '1675', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '757', '24', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2183';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 757, 0, 0
                    , 215.00, -24, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*215.00," WHERE transferproductid = 1676;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('757', '1', '24', '1', '1676', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('757', '3', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 757, 0, 0
                    , 215.00, 24, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('757', '3', '24', '0', '1676', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '758', '28', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2184';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 758, 0, 0
                    , 215.00, -28, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*215.00," WHERE transferproductid = 1677;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('758', '1', '28', '1', '1677', 'تحويل منتجات من المخزن', 'storemovementController.php', '28.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('758', '3', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 758, 0, 0
                    , 215.00, 28, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('758', '3', '28', '0', '1677', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '759', '20', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2185';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 759, 0, 0
                    , 190.00, -20, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*190.00," WHERE transferproductid = 1678;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('759', '1', '20', '1', '1678', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('759', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 759, 0, 0
                    , 190.00, 20, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('759', '3', '20', '0', '1678', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '761', '20', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2187';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 761, 0, 0
                    , 190.00, -20, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*190.00," WHERE transferproductid = 1679;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('761', '1', '20', '1', '1679', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('761', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 761, 0, 0
                    , 190.00, 20, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('761', '3', '20', '0', '1679', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '760', '22', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2186';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 760, 0, 0
                    , 215.00, -22, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-02-24*215.00," WHERE transferproductid = 1680;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('760', '1', '22', '1', '1680', 'تحويل منتجات من المخزن', 'storemovementController.php', '22.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('760', '3', '22', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 760, 0, 0
                    , 215.00, 22, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('760', '3', '22', '0', '1680', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '762', '24', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2188';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 762, 0, 0
                    , 170.00, -24, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*170.00," WHERE transferproductid = 1681;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('762', '1', '24', '1', '1681', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('762', '3', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 762, 0, 0
                    , 170.00, 24, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('762', '3', '24', '0', '1681', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '763', '18', '2022-02-24', '1', '0','261',null,null,'2022-02-24 16:36:35',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2189';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 763, 0, 0
                    , 160.00, -18, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18*2022-02-24*160.00," WHERE transferproductid = 1682;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('763', '1', '18', '1', '1682', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('763', '3', '18', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 763, 0, 0
                    , 160.00, 18, 0, 0, 1, '2022-02-24 16:36:35')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 16:36:35' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('763', '3', '18', '0', '1682', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:06:35";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:36:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 16:36:35', '1', 'editorder', '156.210.120.130', '', '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 < "2022-02-24 13:06:37";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 16:36:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 16:36:37', '7', '', '197.192.204.50', '', '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 < "2022-02-24 13:06:38";
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 < "2022-02-24 13:06:43";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 16:36:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:36:43', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:07:09";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 16:37:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:37:10', '7', 'show', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:08:51";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 16:38:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:38:51', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:19:25";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:49:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:49:25', '4', '', '41.232.89.131', '', '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 < "2022-02-24 13:20:13";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:50:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 16:50:13', '4', '', '41.232.89.131', '', '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 < "2022-02-24 13:20:14";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:20:16";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:50:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:50:16', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:20:53";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:50:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 16:50:53', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:21:02";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:51:02", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:51:02', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:21:26";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:51:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:51:26', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:21:27";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:51:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 16:51:27', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:21:40";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:51:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('cashflowsController.php', '2022-02-24 16:51:40', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:21:55";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:51:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('cashflowsController.php', '2022-02-24 16:51:55', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:22:21";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 16:52:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('cashflowsController.php', '2022-02-24 16:52:21', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:23:21";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:53:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:53:21', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:25:42";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:55:42", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 16:55:42', '4', '', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:26:07";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 16:56:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 16:56:07', '4', 'addsellBill', '41.232.89.131', '', '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 < "2022-02-24 13:44:54";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 17:14:54", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 17:14:54', '4', '', '41.232.89.131', '', '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 < "2022-02-24 13:44:55";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:44:56";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 17:14:57", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:14:57', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 13:57:46";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:27:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 17:27:47', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:17:37";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:47:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 17:47:37', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:20:57";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:50:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:50:57', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:21:56";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:51:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 17:51:56', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '75', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '74.00', '75', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:22:00";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:52:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 17:52:00', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:22:36";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:52:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 17:52:36', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:22:45";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:52:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2022-02-24 17:52:45', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:22:48";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 17:52:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2022-02-24 17:52:48', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:25:47";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:55:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:55:47', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:25:52";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:55:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:55:52', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:23";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:23', '7', 'addAndRetuen', '197.192.204.50', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217aa88ba1c4
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 17:55:52', '06217aa88ba1c4', '1', '0.00', '0', '0', '1', '230', '230', '-230', '0', '5', '2022-02-24 17:56:23', '', '7', '0', 'نقدي','5', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-230','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','329', '0', '2022-02-24 17:56:23', '7', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '230', '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 ('200.00', '00450', '329', '1', '450', '1', '230', '230', '0', '', '1', '0', '450', '0.00', '0','5','0','','','0','0','0','0','0','1');
UPDATE returnsellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 233.75, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 233.75
                where returnsellbilldetailid = 494;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (450, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 230, 200, 280, 233.75
                    , 280, 233.75, 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+230, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+280
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+233.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+280
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+233.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 230, 200, 280, 233.75
                    , 280, 233.75, 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+230, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+280
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+233.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+280
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+233.75
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '7', storedetaildate = '2022-02-24 17:56:23' WHERE storedetailid = '910';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '5', '1', '0', '329', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '8.00', '9', '7', '2022-02-24 17:56:23','0','0');
UPDATE save SET  savecurrentvalue = '330',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('560.00','230', '1', '5', 'اضافة فاتورة مردوات مبيعات', '329', '330', '2022-02-24 17:56:23', '7',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 230, 200, 280, 233.75
                    , 280, 233.75, 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+230, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+280
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+233.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+280
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+233.75
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 230, 200, 280, 233.75
                    , 280, 233.75, 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+230, returnSellCostBuyPrice = returnSellCostBuyPrice+200, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+280
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+233.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+280
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+233.75
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -230, -200, -280
                    , -233.75, -280, -233.75, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-230, netSellCostBuyPrice = netSellCostBuyPrice+-200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-233.75
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-233.75
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217aa88ba1c4 and sellbillId = 329 and returnsellbillId = 329
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:23";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:24', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:27";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:27', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:33";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:34', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:50";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:51', '7', 'addAndRetuen', '197.192.204.50', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217aab2172be
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 17:56:34', '06217aab2172be', '1', '0.00', '0', '0', '1', '180', '180', '180', '0', '5', '2022-02-24 17:56:51', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','180','0','','0','0','180','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1135', '0', '2022-02-24 17:56:51', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '180', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 704;
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 ('175','00387', '1135', '1', '387', '1', '180', '180', '0', '', '1', '2022-02-24 17:56:51', '387', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','704-1,');
UPDATE sellbilldetail SET  lastbuyprice = 175.00 , meanbuyprice = 162.50, lastbuyprice_withDiscount = 175.00, meanbuyprice_withDiscount = 162.50
                where sellbilldetailid = 2400;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (387, '2022-02-24', 180, 150, 175
                    , 162.5, 175, 162.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+162.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+162.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2022-02-24', 180, 150, 175
                    , 162.5, 175, 162.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+162.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+162.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '6', userid = '7', storedetaildate = '2022-02-24 17:56:51' WHERE storedetailid = '903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '5', '1', '1', '1135', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.00', '6', '7', '2022-02-24 17:56:51','0','0');
UPDATE save SET  savecurrentvalue = '510',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('330.00','180', '0', '5', 'اضافة فاتورة مبيعات', '1135', '510', '2022-02-24 17:56:51', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 180, 150, 175
                    , 162.5, 175, 162.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+162.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+162.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 180, 150, 175
                    , 162.5, 175, 162.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+162.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+162.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 180, 150, 175
                    , 162.5, 175, 162.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+180, netSellCostBuyPrice = netSellCostBuyPrice+150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+175
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+162.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+175
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+162.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217aab2172be and sellbillId = 1135 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:26:51";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:56:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 17:56:51', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:27:18";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 17:57:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 17:57:18', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:35:50";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:05:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:05:50', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:01";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:06:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:06:02', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:09";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:06:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:06:09', '1', 'showDetail', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:23";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 18:06:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:06:23', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:36";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:06:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2022-02-24 18:06:36', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:48";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:06:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:06:49', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:36:50";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:06:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2022-02-24 18:06:50', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:37:06";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 18:07:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2022-02-24 18:07:06', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:37:07";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:07:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:07:07', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:37:07";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:07:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:07:08', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:37:44";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:07:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:07:44', '7', 'addAndRetuen', '197.192.204.50', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217ad2c27bde
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 18:07:08', '06217ad2c27bde', '1', '0.00', '0', '0', '1', '230', '230', '230', '0', '5', '2022-02-24 18:07:44', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','230','0','','0','0','230','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','اضافة فاتورة مبيعات','1136', '0', '2022-02-24 18:07:44', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '230', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2670;
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', '1136', '1', '465', '1', '230.00', '230', '0', '', '2', '2022-02-24 18:07:44', '465', '0.00', '0', '5','0','','','0','0','0','0','0','0','2','0','','2670-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 2401;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (465, '2022-02-24', 230, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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 (5, '2022-02-24', 230, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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 = '8', userid = '7', storedetaildate = '2022-02-24 18:07:44' WHERE storedetailid = '1885';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '5', '1', '1', '1136', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '8', '7', '2022-02-24 18:07:44','0','0');
UPDATE save SET  savecurrentvalue = '740',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('510.00','230', '0', '5', 'اضافة فاتورة مبيعات', '1136', '740', '2022-02-24 18:07:44', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 230, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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, '2022-02-24', 230, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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, 230, 210, 210
                    , 210, 210, 210, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+230, netSellCostBuyPrice = netSellCostBuyPrice+210
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+210
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+210
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+210
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+210
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217ad2c27bde and sellbillId = 1136 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:37:44";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:07:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:07:44', '7', 'addsellBill', '197.192.204.50', '', '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 < "2022-02-24 14:41:42";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 18:11:42", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 18:11:42', '8', '', '154.176.108.55', '', '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 < "2022-02-24 14:41:42";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:41:49";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 18:11:50", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:11:50', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:44:18";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:14:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 18:14:18', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:44:22";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:14:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:14:22', '7', 'showDetail', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:44:31";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:14:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 18:14:31', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:44:54";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:14:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 18:14:55', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:45:30";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:15:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 18:15:30', '7', 'show', '197.192.204.50', '', '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 < "2022-02-24 14:46:12";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 18:16:12", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 18:16:12', '8', '', '154.176.108.55', '', '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 < "2022-02-24 14:46:12";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 14:46:15";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 18:16:15", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:16:15', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:00:03";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:30:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 18:30:03', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:00:24";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:30:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:30:24', '7', 'showDetail', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:14:09";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:44:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:44:10', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:15:47";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:45:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:45:48', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:17:20";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:47:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 18:47:20', '7', '', '197.192.204.50', '', '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 < "2022-02-24 15:17:20";
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 < "2022-02-24 15:17:59";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:47:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:48:00', '7', 'addAndRetuen', '197.192.204.50', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217b63c24a9c
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 18:45:48', '06217b63c24a9c', '1', '0.00', '0', '0', '1', '210', '210', '-210', '0', '5', '2022-02-24 18:48:00', '', '7', '0', 'نقدي','5', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-210','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','330', '0', '2022-02-24 18:48:00', '7', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '210', '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', '00517', '330', '1', '517', '1', '210.00', '210', '0', '', '2', '0', '517', '0.00', '0','5','0','','','0','0','0','0','0','2');
UPDATE returnsellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where returnsellbilldetailid = 495;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (517, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 210, 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+210, 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 (5, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 210, 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+210, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2022-02-24 18:48:00' WHERE storedetailid = '908';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '5', '1', '0', '330', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '20.00', '21', '7', '2022-02-24 18:48:00','0','0');
UPDATE save SET  savecurrentvalue = '530',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('740.00','210', '1', '5', 'اضافة فاتورة مردوات مبيعات', '330', '530', '2022-02-24 18:48:00', '7',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 210, 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+210, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 0, 0, 0
                    , 0, 0, 0, 0
                    , 210, 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+210, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -210, -210, -210
                    , -210, -210, -210, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-210, netSellCostBuyPrice = netSellCostBuyPrice+-210
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-210
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-210
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-210
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-210
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217b63c24a9c and sellbillId = 330 and returnsellbillId = 330
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:18:00";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:48:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:48:00', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:18:38";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:48:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:48:38', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:22:49";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:52:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:52:49', '7', 'addAndRetuen', '197.192.204.50', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217b6e6eda7e
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 18:48:38', '06217b6e6eda7e', '1', '0.00', '0', '0', '1', '210', '210', '210', '0', '5', '2022-02-24 18:52:49', '', '7', '0', 'نقدي', '5', '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 = '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','اضافة فاتورة مبيعات','1137', '0', '2022-02-24 18:52:49', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '210', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 714;
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','00517', '1137', '1', '517', '1', '210.00', '210', '0', '', '2', '2022-02-24 18:52:49', '517', '0.00', '0', '5','0','','','0','0','0','0','0','0','2','0','','714-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 2402;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (517, '2022-02-24', 210, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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 (5, '2022-02-24', 210, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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 = '20', userid = '7', storedetaildate = '2022-02-24 18:52:49' WHERE storedetailid = '908';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '5', '1', '1', '1137', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21.00', '20', '7', '2022-02-24 18:52:49','0','0');
UPDATE save SET  savecurrentvalue = '740',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('530.00','210', '0', '5', 'اضافة فاتورة مبيعات', '1137', '740', '2022-02-24 18:52:49', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 210, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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, '2022-02-24', 210, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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, 210, 210, 210
                    , 210, 210, 210, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+210, netSellCostBuyPrice = netSellCostBuyPrice+210
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+210
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+210
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+210
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+210
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217b6e6eda7e and sellbillId = 1137 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:22:50";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 18:52:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 18:52:50', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:33:42";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 19:03:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 19:03:43', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:34:02";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 19:04:02", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 19:04:02', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:34:15";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 19:04:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2022-02-24 19:04:15', '7', 'show', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 15:56:30";
UPDATE user SET loginip = "41.232.89.131", lastactivetime = "2022-02-24 19:26:30", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 19:26:30', '4', 'addsellBill', '41.232.89.131', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:04:48";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:34:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 19:34:48', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:14:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:44:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2022-02-24 19:44:47', '1', 'add', '156.210.120.130', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('7','9', '14060', '2022-02-24', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '50',  userid = '1' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14110.00','14060', '1', '7', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '53', '50', '2022-02-24 19:44:47', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '156655',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('142595.00','14060', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل العميد ] ', '53', '156655', '2022-02-24 19:44:47', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '14060', '14060', '2022-02-24', '1', '0', '0', '2022-02-24 19:44:47','اضافة تحويل من خزينة محل العميد الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1570', '156', '14060', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '156655', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1570', '141', '14060', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-126840', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE transfermoney SET saveidfrom = '7', saveidto = '9', transfermoneyvalue = '14060.00', transfermoneydate = '2022-02-24', userid = '1', conditions = '0' , dailyentryid = '1570' , comment = '' WHERE transfermoneyid = '53';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:14:47";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:44:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2022-02-24 19:44:47', '1', 'sucess', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:14:49";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:44:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2022-02-24 19:44:49', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:14:52";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:44:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 19:44:52', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:16:09";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:46:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:46:09', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:17:13";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:47:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:47:13', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '37';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('37', '1', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '16.00', '34', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:17:15";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:47:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:47:15', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:17:55";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:47:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 19:47:55', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:23:43";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:53:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:53:43', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:25:10";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:55:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:55:10', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '240', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2151';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '1', '240', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '240', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:25:12";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:55:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 19:55:12', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:27:42";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 19:57:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 19:57:42', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:51:16";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 20:21:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 20:21:16', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '300', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2166';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '1', '300', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '300', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:51:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 20:21:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 20:21:18', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:51:44";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 20:21:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 20:21:44', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '308', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2167';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '1', '308', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '308', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:51:46";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 20:21:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 20:21:46', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 16:53:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 20:23:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 20:23:19', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:32:16";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:02:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:02:17', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:35:00";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:05:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:05:00', '1', 'add', '156.210.120.130', '', '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 ('نوارة الشام2035 الاسكندرية','','1','160','160', '200','170', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '160','160','160','160','160','0','0','6.25','25','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'نوارة الشام2035 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160', productSellAllPrice = '160', productSellUnitPrice = '200', productSellHalfPrice = '170', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00764',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '764';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '764', '1', '2022-02-24', '1', '0','0076401','160','170','200','160');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('764', '1', '43', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '1', '43', '0', '764', 'إضافة منتج', 'productController.php', '0', '43', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (764, 1,'2022-02-24 21:05:00',1)
                ON DUPLICATE KEY UPDATE productid = 764, edited = 1, sysdate = '2022-02-24 21:05:00', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '6880', '6880', '2022-02-24', '1', '0', '0', '2022-02-24 21:05:00','إضافة منتج نوارة الشام2035 الاسكندرية الكمية 43','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1571', '19', '6880', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6783924.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1571', '7', '6880', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7635625.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'نوارة الشام2035 الاسكندرية', productDescription = '', productCatId = '1', productBuyPrice = '160.00', productSellAllPrice = '160.00', productSellUnitPrice = '200.00', productSellHalfPrice = '170.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00764',type ='0', expireDate = '0' , dailyentryId = '1571',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '764';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:35:02";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:05:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:05:02', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:35:04";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:05:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:05:04', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:35:32";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:05:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:05:32', '1', 'add', '156.210.120.130', '', '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(265,1,3,764,43,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 21:05:33',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2198';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 764, 0, 0
                    , 160.00, -43, 0, 0, 1, '2022-02-24 21:05:33')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-43, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:05:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "43*2022-02-24*160.00," WHERE transferproductid = 1683;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '1', '43', '1', '1683', 'تحويل منتجات من المخزن', 'storemovementController.php', '43.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('764', '3', '43', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 764, 0, 0
                    , 160.00, 43, 0, 0, 1, '2022-02-24 21:05:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+43, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:05:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('764', '3', '43', '0', '1683', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '43', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:35:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:05:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:05:33', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:38:04";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:08:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 21:08:04', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:38:18";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:08:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:08:18', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:38:37";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:08:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:08:37', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:38:54";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:08:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:08:54', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:39:17";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:09:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:09:17', '1', 'add', '156.210.120.130', '', '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 ('ستان جاكار8004','','1','220','220', '260','230', '2022-02-24', '0', '1', '0', '', '0', '0', '0', '0', '0', '220','220','220','220','220','0','0','4.55','18.18','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ستان جاكار8004', productDescription = '', productCatId = '1', productBuyPrice = '220', productSellAllPrice = '220', productSellUnitPrice = '260', productSellHalfPrice = '230', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00765',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '220',lastbuyprice_withDiscount = '220',meanbuyprice = '220',meanbuyprice_withDiscount = '220' , productbuypricereal = '220' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.55' , buypart_precentage = '18.18',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '765';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '765', '1', '2022-02-24', '1', '0','0076501','220','230','260','220');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('765', '1', '60', '1', '2022-02-24');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '1', '60', '0', '765', 'إضافة منتج', 'productController.php', '0', '60', '1', '2022-02-24','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (765, 1,'2022-02-24 21:09:17',1)
                ON DUPLICATE KEY UPDATE productid = 765, edited = 1, sysdate = '2022-02-24 21:09:17', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '13200', '13200', '2022-02-24', '1', '0', '0', '2022-02-24 21:09:17','إضافة منتج ستان جاكار8004 الكمية 60','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1572', '19', '13200', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6797124.35', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1572', '7', '13200', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '7648825.15', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ستان جاكار8004', productDescription = '', productCatId = '1', productBuyPrice = '220.00', productSellAllPrice = '220.00', productSellUnitPrice = '260.00', productSellHalfPrice = '230.00', productDate = '2022-02-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00765',type ='0', expireDate = '0' , dailyentryId = '1572',isService = '0',isOptic = '0',lastbuyprice = '220',lastbuyprice_withDiscount = '220',meanbuyprice = '220',meanbuyprice_withDiscount = '220' , productbuypricereal = '220' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.55' , buypart_precentage = '18.18',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '765';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:39:19";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:09:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2022-02-24 21:09:19', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:48:59";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:18:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:18:59', '1', 'add', '156.210.120.130', '', '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(262,1,3,436,36,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 21:19:00',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '142', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '436';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 436, 0, 0
                    , 160.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*160.00," WHERE transferproductid = 1684;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '1', '36', '1', '1684', 'تحويل منتجات من المخزن', 'storemovementController.php', '178.00', '142', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2020';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 436, 0, 0
                    , 160.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '3', '36', '0', '1684', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '299', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '579', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '299';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 299, 0, 0
                    , 155.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*155.00," WHERE transferproductid = 1685;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '1', '36', '1', '1685', 'تحويل منتجات من المخزن', 'storemovementController.php', '615.00', '579', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2019';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 299, 0, 0
                    , 155.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '3', '36', '0', '1685', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '572', '32', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '127', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1531';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 572, 0, 0
                    , 210.00, -32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*210.00," WHERE transferproductid = 1686;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '1', '32', '1', '1686', 'تحويل منتجات من المخزن', 'storemovementController.php', '159.00', '127', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('572', '3', '32', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 572, 0, 0
                    , 210.00, 32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '3', '32', '0', '1686', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '569', '34', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '239', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1528';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 569, 0, 0
                    , 210.00, -34, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "34*2022-02-24*210.00," WHERE transferproductid = 1687;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '1', '34', '1', '1687', 'تحويل منتجات من المخزن', 'storemovementController.php', '273.00', '239', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('569', '3', '34', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 569, 0, 0
                    , 210.00, 34, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '3', '34', '0', '1687', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '34', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '571', '28', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1530';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 571, 0, 0
                    , 210.00, -28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*210.00," WHERE transferproductid = 1688;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '28', '1', '1688', 'تحويل منتجات من المخزن', 'storemovementController.php', '258.00', '230', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2016';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 571, 0, 0
                    , 210.00, 28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '3', '28', '0', '1688', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '29', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '181', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '135', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '181';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 181, 0, 0
                    , 195.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*195.00," WHERE transferproductid = 1689;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '1', '36', '1', '1689', 'تحويل منتجات من المخزن', 'storemovementController.php', '171.00', '135', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1382';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 181, 0, 0
                    , 195.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '3', '36', '0', '1689', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '26.00', '62', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '669', '31', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '173', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1953';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 669, 0, 0
                    , 180.00, -31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*180.00," WHERE transferproductid = 1690;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '1', '31', '1', '1690', 'تحويل منتجات من المخزن', 'storemovementController.php', '204.00', '173', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2018';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 669, 0, 0
                    , 180.00, 31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '3', '31', '0', '1690', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '671', '29', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1955';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 671, 0, 0
                    , 180.00, -29, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29*2022-02-24*180.00," WHERE transferproductid = 1691;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '1', '29', '1', '1691', 'تحويل منتجات من المخزن', 'storemovementController.php', '91.00', '62', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2017';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 671, 0, 0
                    , 180.00, 29, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '3', '29', '0', '1691', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '30', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '39', '31', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '39';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 39, 0, 0
                    , 145.00, -31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*145.00," WHERE transferproductid = 1692;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '1', '31', '1', '1692', 'تحويل منتجات من المخزن', 'storemovementController.php', '51.00', '20', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('39', '3', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 39, 0, 0
                    , 145.00, 31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '3', '31', '0', '1692', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '37', '34', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '37';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 37, 0, 0
                    , 145.00, -34, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "34*2022-02-24*145.00," WHERE transferproductid = 1693;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('37', '1', '34', '1', '1693', 'تحويل منتجات من المخزن', 'storemovementController.php', '34.00', '0', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1593';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 37, 0, 0
                    , 145.00, 34, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+34, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('37', '3', '34', '0', '1693', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '8.00', '42', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '283', '29', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '178', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '283';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 283, 0, 0
                    , 150.00, -29, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29*2022-02-24*150.00," WHERE transferproductid = 1694;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '29', '1', '1694', 'تحويل منتجات من المخزن', 'storemovementController.php', '207.00', '178', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('283', '3', '29', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 283, 0, 0
                    , 150.00, 29, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '3', '29', '0', '1694', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '29', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '416', '20', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '130', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '416';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 416, 0, 0
                    , 140.00, -20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*140.00," WHERE transferproductid = 1695;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '20', '1', '1695', 'تحويل منتجات من المخزن', 'storemovementController.php', '150.00', '130', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('416', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 416, 0, 0
                    , 140.00, 20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '3', '20', '0', '1695', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '638', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1916';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 638, 0, 0
                    , 180.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*180.00," WHERE transferproductid = 1696;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '1', '36', '1', '1696', 'تحويل منتجات من المخزن', 'storemovementController.php', '104.00', '68', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('638', '3', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 638, 0, 0
                    , 180.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '3', '36', '0', '1696', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '660', '23', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1941';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 660, 0, 0
                    , 205.00, -23, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*205.00," WHERE transferproductid = 1697;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '23', '1', '1697', 'تحويل منتجات من المخزن', 'storemovementController.php', '59.00', '36', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('660', '3', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 660, 0, 0
                    , 205.00, 23, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '3', '23', '0', '1697', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '658', '22', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1939';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 658, 0, 0
                    , 215.00, -22, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-02-24*215.00," WHERE transferproductid = 1698;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '1', '22', '1', '1698', 'تحويل منتجات من المخزن', 'storemovementController.php', '64.00', '42', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('658', '3', '22', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 658, 0, 0
                    , 215.00, 22, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '3', '22', '0', '1698', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '412', '26', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '412';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 412, 0, 0
                    , 140.00, -26, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-02-24*140.00," WHERE transferproductid = 1699;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('412', '1', '26', '1', '1699', 'تحويل منتجات من المخزن', 'storemovementController.php', '26.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('412', '3', '26', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 412, 0, 0
                    , 140.00, 26, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('412', '3', '26', '0', '1699', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '26', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '647', '32', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '169', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1927';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 647, 0, 0
                    , 280.00, -32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 280.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*280.00," WHERE transferproductid = 1700;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '1', '32', '1', '1700', 'تحويل منتجات من المخزن', 'storemovementController.php', '201.00', '169', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2023';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 647, 0, 0
                    , 280.00, 32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '3', '32', '0', '1700', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '33', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '645', '32', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '141', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1925';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 645, 0, 0
                    , 205.00, -32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*205.00," WHERE transferproductid = 1701;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '1', '32', '1', '1701', 'تحويل منتجات من المخزن', 'storemovementController.php', '173.00', '141', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('645', '3', '32', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 645, 0, 0
                    , 205.00, 32, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '3', '32', '0', '1701', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '643', '24', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1923';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 643, 0, 0
                    , 170.00, -24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*170.00," WHERE transferproductid = 1702;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '1', '24', '1', '1702', 'تحويل منتجات من المخزن', 'storemovementController.php', '81.00', '57', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2021';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 643, 0, 0
                    , 170.00, 24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '3', '24', '0', '1702', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '25', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '676', '30', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1960';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 676, 0, 0
                    , 165.00, -30, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 165.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*165.00," WHERE transferproductid = 1703;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '1', '30', '1', '1703', 'تحويل منتجات من المخزن', 'storemovementController.php', '30.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('676', '3', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 676, 0, 0
                    , 165.00, 30, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('676', '3', '30', '0', '1703', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '639', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '87', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1918';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 639, 0, 0
                    , 125.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 125.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*125.00," WHERE transferproductid = 1704;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '1', '36', '1', '1704', 'تحويل منتجات من المخزن', 'storemovementController.php', '123.00', '87', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('639', '3', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 639, 0, 0
                    , 125.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '3', '36', '0', '1704', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '641', '37', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1920';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 641, 0, 0
                    , 140.00, -37, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "37*2022-02-24*140.00," WHERE transferproductid = 1705;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('641', '1', '37', '1', '1705', 'تحويل منتجات من المخزن', 'storemovementController.php', '79.00', '42', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('641', '3', '37', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 641, 0, 0
                    , 140.00, 37, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('641', '3', '37', '0', '1705', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '664', '28', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '246', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1948';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 664, 0, 0
                    , 140.00, -28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*140.00," WHERE transferproductid = 1706;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '1', '28', '1', '1706', 'تحويل منتجات من المخزن', 'storemovementController.php', '274.00', '246', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2013';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 664, 0, 0
                    , 140.00, 28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '3', '28', '0', '1706', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '29', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '674', '23', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '69', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1958';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 674, 0, 0
                    , 145.00, -23, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*145.00," WHERE transferproductid = 1707;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '1', '23', '1', '1707', 'تحويل منتجات من المخزن', 'storemovementController.php', '92.00', '69', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('674', '3', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 674, 0, 0
                    , 145.00, 23, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '3', '23', '0', '1707', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '656', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '191', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1937';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 656, 0, 0
                    , 200.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*200.00," WHERE transferproductid = 1708;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '1', '36', '1', '1708', 'تحويل منتجات من المخزن', 'storemovementController.php', '227.00', '191', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2022';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 656, 0, 0
                    , 200.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '3', '36', '0', '1708', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '593', '24', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '144', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1610';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 593, 0, 0
                    , 200.00, -24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*200.00," WHERE transferproductid = 1709;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '24', '1', '1709', 'تحويل منتجات من المخزن', 'storemovementController.php', '168.00', '144', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1611';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 593, 0, 0
                    , 200.00, 24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '3', '24', '0', '1709', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '25', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '649', '36', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1929';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 649, 0, 0
                    , 185.00, -36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*185.00," WHERE transferproductid = 1710;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('649', '1', '36', '1', '1710', 'تحويل منتجات من المخزن', 'storemovementController.php', '42.00', '6', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2024';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 649, 0, 0
                    , 185.00, 36, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('649', '3', '36', '0', '1710', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '738', '24', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '204', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2150';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 738, 0, 0
                    , 190.00, -24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*190.00," WHERE transferproductid = 1711;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '1', '24', '1', '1711', 'تحويل منتجات من المخزن', 'storemovementController.php', '228.00', '204', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('738', '3', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 738, 0, 0
                    , 190.00, 24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '3', '24', '0', '1711', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '739', '27', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '213', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2151';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 739, 0, 0
                    , 190.00, -27, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2022-02-24*190.00," WHERE transferproductid = 1712;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '1', '27', '1', '1712', 'تحويل منتجات من المخزن', 'storemovementController.php', '240.00', '213', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('739', '3', '27', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 739, 0, 0
                    , 190.00, 27, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '3', '27', '0', '1712', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '17', '20', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '17';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 17, 0, 0
                    , 185.00, -20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*185.00," WHERE transferproductid = 1713;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '1', '20', '1', '1713', 'تحويل منتجات من المخزن', 'storemovementController.php', '64.00', '44', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1323';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 17, 0, 0
                    , 185.00, 20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '3', '20', '0', '1713', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '3', '24', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '3';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 3, 0, 0
                    , 155.00, -24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*155.00," WHERE transferproductid = 1714;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '24', '1', '1714', 'تحويل منتجات من المخزن', 'storemovementController.php', '55.00', '31', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1398';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 3, 0, 0
                    , 155.00, 24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '3', '24', '0', '1714', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '6', '31', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '128', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '6';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 6, 0, 0
                    , 145.00, -31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*145.00," WHERE transferproductid = 1715;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '31', '1', '1715', 'تحويل منتجات من المخزن', 'storemovementController.php', '159.00', '128', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1385';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 6, 0, 0
                    , 145.00, 31, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '3', '31', '0', '1715', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '1.00', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '634', '28', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '271', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1911';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 634, 0, 0
                    , 210.00, -28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*210.00," WHERE transferproductid = 1716;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '1', '28', '1', '1716', 'تحويل منتجات من المخزن', 'storemovementController.php', '299.00', '271', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('634', '3', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 634, 0, 0
                    , 210.00, 28, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '3', '28', '0', '1716', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '570', '20', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '194', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1529';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 570, 0, 0
                    , 210.00, -20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*210.00," WHERE transferproductid = 1717;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '1', '20', '1', '1717', 'تحويل منتجات من المخزن', 'storemovementController.php', '214.00', '194', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('570', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 570, 0, 0
                    , 210.00, 20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '3', '20', '0', '1717', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '747', '24', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '276', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2166';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 747, 0, 0
                    , 195.00, -24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*195.00," WHERE transferproductid = 1718;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '1', '24', '1', '1718', 'تحويل منتجات من المخزن', 'storemovementController.php', '300.00', '276', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('747', '3', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 747, 0, 0
                    , 195.00, 24, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '3', '24', '0', '1718', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '748', '26', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '282', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2167';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 748, 0, 0
                    , 185.00, -26, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-02-24*185.00," WHERE transferproductid = 1719;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '1', '26', '1', '1719', 'تحويل منتجات من المخزن', 'storemovementController.php', '308.00', '282', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('748', '3', '26', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 748, 0, 0
                    , 185.00, 26, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '3', '26', '0', '1719', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '26', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '3', '765', '20', '2022-02-24', '1', '0','262',null,null,'2022-02-24 21:19:00',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2200';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 765, 0, 0
                    , 220.00, -20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*220.00," WHERE transferproductid = 1720;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '1', '20', '1', '1720', 'تحويل منتجات من المخزن', 'storemovementController.php', '60.00', '40', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('765', '3', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 765, 0, 0
                    , 220.00, 20, 0, 0, 1, '2022-02-24 21:19:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:19:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '3', '20', '0', '1720', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:49:00";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:19:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:19:00', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:50:44";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:20:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:20:44', '1', 'add', '156.210.120.130', '', '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(263,1,6,436,36,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 21:20:44',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '106', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '436';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 436, 0, 0
                    , 160.00, -36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*160.00," WHERE transferproductid = 1721;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '1', '36', '1', '1721', 'تحويل منتجات من المخزن', 'storemovementController.php', '142.00', '106', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('436', '6', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 436, 0, 0
                    , 160.00, 36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '6', '36', '0', '1721', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '299', '36', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '543', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '299';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 299, 0, 0
                    , 155.00, -36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*155.00," WHERE transferproductid = 1722;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '1', '36', '1', '1722', 'تحويل منتجات من المخزن', 'storemovementController.php', '579.00', '543', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('299', '6', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 299, 0, 0
                    , 155.00, 36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '6', '36', '0', '1722', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '572', '32', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '95', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1531';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 572, 0, 0
                    , 210.00, -32, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*210.00," WHERE transferproductid = 1723;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '1', '32', '1', '1723', 'تحويل منتجات من المخزن', 'storemovementController.php', '127.00', '95', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('572', '6', '32', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 572, 0, 0
                    , 210.00, 32, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '6', '32', '0', '1723', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '635', '16', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '211', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1912';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 635, 0, 0
                    , 210.00, -16, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2022-02-24*210.00," WHERE transferproductid = 1724;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '1', '16', '1', '1724', 'تحويل منتجات من المخزن', 'storemovementController.php', '227.00', '211', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('635', '6', '16', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 635, 0, 0
                    , 210.00, 16, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '6', '16', '0', '1724', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '16', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '569', '32', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '207', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1528';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 569, 0, 0
                    , 210.00, -32, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*210.00," WHERE transferproductid = 1725;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '1', '32', '1', '1725', 'تحويل منتجات من المخزن', 'storemovementController.php', '239.00', '207', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('569', '6', '32', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 569, 0, 0
                    , 210.00, 32, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '6', '32', '0', '1725', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '571', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '206', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1530';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 571, 0, 0
                    , 210.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*210.00," WHERE transferproductid = 1726;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '24', '1', '1726', 'تحويل منتجات من المخزن', 'storemovementController.php', '230.00', '206', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('571', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 571, 0, 0
                    , 210.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '6', '24', '0', '1726', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '669', '31', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '142', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1953';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 669, 0, 0
                    , 180.00, -31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*180.00," WHERE transferproductid = 1727;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '1', '31', '1', '1727', 'تحويل منتجات من المخزن', 'storemovementController.php', '173.00', '142', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('669', '6', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 669, 0, 0
                    , 180.00, 31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '6', '31', '0', '1727', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '671', '21', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1955';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 671, 0, 0
                    , 180.00, -21, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-02-24*180.00," WHERE transferproductid = 1728;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '1', '21', '1', '1728', 'تحويل منتجات من المخزن', 'storemovementController.php', '62.00', '41', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('671', '6', '21', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 671, 0, 0
                    , 180.00, 21, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '6', '21', '0', '1728', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '39', '31', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-11', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '39';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 39, 0, 0
                    , 145.00, -31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*145.00," WHERE transferproductid = 1729;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '1', '31', '1', '1729', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '-11', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('39', '6', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 39, 0, 0
                    , 145.00, 31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '6', '31', '0', '1729', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '283', '29', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '283';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 283, 0, 0
                    , 150.00, -29, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29*2022-02-24*150.00," WHERE transferproductid = 1730;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '29', '1', '1730', 'تحويل منتجات من المخزن', 'storemovementController.php', '178.00', '149', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('283', '6', '29', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 283, 0, 0
                    , 150.00, 29, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '6', '29', '0', '1730', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '29', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '681', '23', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '256', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1965';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 681, 0, 0
                    , 155.00, -23, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*155.00," WHERE transferproductid = 1731;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '1', '23', '1', '1731', 'تحويل منتجات من المخزن', 'storemovementController.php', '279.00', '256', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('681', '6', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 681, 0, 0
                    , 155.00, 23, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '6', '23', '0', '1731', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '416', '20', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '416';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 416, 0, 0
                    , 140.00, -20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*140.00," WHERE transferproductid = 1732;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '20', '1', '1732', 'تحويل منتجات من المخزن', 'storemovementController.php', '130.00', '110', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1015';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 416, 0, 0
                    , 140.00, 20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '6', '20', '0', '1732', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '638', '31', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1916';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 638, 0, 0
                    , 180.00, -31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*180.00," WHERE transferproductid = 1733;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '1', '31', '1', '1733', 'تحويل منتجات من المخزن', 'storemovementController.php', '68.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('638', '6', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 638, 0, 0
                    , 180.00, 31, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('638', '6', '31', '0', '1733', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '637', '38', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '76', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1915';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 637, 0, 0
                    , 185.00, -38, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-38, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "38*2022-02-24*185.00," WHERE transferproductid = 1734;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '1', '38', '1', '1734', 'تحويل منتجات من المخزن', 'storemovementController.php', '114.00', '76', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('637', '6', '38', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 637, 0, 0
                    , 185.00, 38, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+38, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '6', '38', '0', '1734', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '38', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '660', '12', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1941';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 660, 0, 0
                    , 205.00, -12, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "12*2022-02-24*205.00," WHERE transferproductid = 1735;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '12', '1', '1735', 'تحويل منتجات من المخزن', 'storemovementController.php', '36.00', '24', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('660', '6', '12', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 660, 0, 0
                    , 205.00, 12, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '6', '12', '0', '1735', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '12', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '658', '11', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1939';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 658, 0, 0
                    , 215.00, -11, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "11*2022-02-24*215.00," WHERE transferproductid = 1736;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '1', '11', '1', '1736', 'تحويل منتجات من المخزن', 'storemovementController.php', '42.00', '31', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('658', '6', '11', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 658, 0, 0
                    , 215.00, 11, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '6', '11', '0', '1736', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '11', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '662', '19', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1943';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 662, 0, 0
                    , 185.00, -19, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "19*2022-02-24*185.00," WHERE transferproductid = 1737;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('662', '1', '19', '1', '1737', 'تحويل منتجات من المخزن', 'storemovementController.php', '53.00', '34', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('662', '6', '19', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 662, 0, 0
                    , 185.00, 19, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('662', '6', '19', '0', '1737', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '19', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '647', '20', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1927';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 647, 0, 0
                    , 280.00, -20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 280.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*280.00," WHERE transferproductid = 1738;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '1', '20', '1', '1738', 'تحويل منتجات من المخزن', 'storemovementController.php', '169.00', '149', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('647', '6', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 647, 0, 0
                    , 280.00, 20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '6', '20', '0', '1738', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '645', '20', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '121', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1925';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 645, 0, 0
                    , 205.00, -20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*205.00," WHERE transferproductid = 1739;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '1', '20', '1', '1739', 'تحويل منتجات من المخزن', 'storemovementController.php', '141.00', '121', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('645', '6', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 645, 0, 0
                    , 205.00, 20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '6', '20', '0', '1739', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '639', '36', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1918';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 639, 0, 0
                    , 125.00, -36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 125.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*125.00," WHERE transferproductid = 1740;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '1', '36', '1', '1740', 'تحويل منتجات من المخزن', 'storemovementController.php', '87.00', '51', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('639', '6', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 639, 0, 0
                    , 125.00, 36, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('639', '6', '36', '0', '1740', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '678', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '224', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1962';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 678, 0, 0
                    , 145.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*145.00," WHERE transferproductid = 1741;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '1', '24', '1', '1741', 'تحويل منتجات من المخزن', 'storemovementController.php', '248.00', '224', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('678', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 678, 0, 0
                    , 145.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '6', '24', '0', '1741', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '664', '23', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1948';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 664, 0, 0
                    , 140.00, -23, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*140.00," WHERE transferproductid = 1742;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '1', '23', '1', '1742', 'تحويل منتجات من المخزن', 'storemovementController.php', '246.00', '223', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('664', '6', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 664, 0, 0
                    , 140.00, 23, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '6', '23', '0', '1742', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '674', '20', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '49', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1958';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 674, 0, 0
                    , 145.00, -20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*145.00," WHERE transferproductid = 1743;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '1', '20', '1', '1743', 'تحويل منتجات من المخزن', 'storemovementController.php', '69.00', '49', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('674', '6', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 674, 0, 0
                    , 145.00, 20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '6', '20', '0', '1743', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '656', '26', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '165', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1937';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 656, 0, 0
                    , 200.00, -26, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-02-24*200.00," WHERE transferproductid = 1744;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '1', '26', '1', '1744', 'تحويل منتجات من المخزن', 'storemovementController.php', '191.00', '165', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('656', '6', '26', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 656, 0, 0
                    , 200.00, 26, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '6', '26', '0', '1744', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '26', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '593', '19', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1610';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 593, 0, 0
                    , 200.00, -19, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "19*2022-02-24*200.00," WHERE transferproductid = 1745;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '19', '1', '1745', 'تحويل منتجات من المخزن', 'storemovementController.php', '144.00', '125', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('593', '6', '19', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 593, 0, 0
                    , 200.00, 19, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '6', '19', '0', '1745', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '19', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '666', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '100', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1950';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 666, 0, 0
                    , 200.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*200.00," WHERE transferproductid = 1746;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('666', '1', '24', '1', '1746', 'تحويل منتجات من المخزن', 'storemovementController.php', '124.00', '100', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('666', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 666, 0, 0
                    , 200.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('666', '6', '24', '0', '1746', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '738', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '180', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2150';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 738, 0, 0
                    , 190.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*190.00," WHERE transferproductid = 1747;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '1', '24', '1', '1747', 'تحويل منتجات من المخزن', 'storemovementController.php', '204.00', '180', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('738', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 738, 0, 0
                    , 190.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '6', '24', '0', '1747', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '739', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '189', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2151';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 739, 0, 0
                    , 190.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*190.00," WHERE transferproductid = 1748;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '1', '24', '1', '1748', 'تحويل منتجات من المخزن', 'storemovementController.php', '213.00', '189', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('739', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 739, 0, 0
                    , 190.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '6', '24', '0', '1748', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '123', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '237', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '123';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 123, 0, 0
                    , 200.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*200.00," WHERE transferproductid = 1749;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '24', '1', '1749', 'تحويل منتجات من المخزن', 'storemovementController.php', '261.00', '237', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('123', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 123, 0, 0
                    , 200.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '6', '24', '0', '1749', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '634', '27', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '244', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1911';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 634, 0, 0
                    , 210.00, -27, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2022-02-24*210.00," WHERE transferproductid = 1750;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '1', '27', '1', '1750', 'تحويل منتجات من المخزن', 'storemovementController.php', '271.00', '244', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('634', '6', '27', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 634, 0, 0
                    , 210.00, 27, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('634', '6', '27', '0', '1750', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '747', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '252', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2166';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 747, 0, 0
                    , 195.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*195.00," WHERE transferproductid = 1751;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '1', '24', '1', '1751', 'تحويل منتجات من المخزن', 'storemovementController.php', '276.00', '252', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('747', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 747, 0, 0
                    , 195.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '6', '24', '0', '1751', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '748', '24', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '258', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2167';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 748, 0, 0
                    , 185.00, -24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*185.00," WHERE transferproductid = 1752;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '1', '24', '1', '1752', 'تحويل منتجات من المخزن', 'storemovementController.php', '282.00', '258', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('748', '6', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 748, 0, 0
                    , 185.00, 24, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '6', '24', '0', '1752', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '765', '20', '2022-02-24', '1', '0','263',null,null,'2022-02-24 21:20:44',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2200';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 765, 0, 0
                    , 220.00, -20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*220.00," WHERE transferproductid = 1753;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '1', '20', '1', '1753', 'تحويل منتجات من المخزن', 'storemovementController.php', '40.00', '20', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('765', '6', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 6, 765, 0, 0
                    , 220.00, 20, 0, 0, 1, '2022-02-24 21:20:44')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:20:44' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '6', '20', '0', '1753', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:50:45";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:20:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:20:45', '1', 'editorder', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:51:33";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:21:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:21:33', '1', 'add', '156.210.120.130', '', '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(264,1,5,436,36,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 21:21:33',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '436';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 436, 0, 0
                    , 160.00, -36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*160.00," WHERE transferproductid = 1754;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '1', '36', '1', '1754', 'تحويل منتجات من المخزن', 'storemovementController.php', '106.00', '70', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1638';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 436, 0, 0
                    , 160.00, 36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('436', '5', '36', '0', '1754', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '38', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '299', '36', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '507', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '299';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 299, 0, 0
                    , 155.00, -36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*155.00," WHERE transferproductid = 1755;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '1', '36', '1', '1755', 'تحويل منتجات من المخزن', 'storemovementController.php', '543.00', '507', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('299', '5', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 299, 0, 0
                    , 155.00, 36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '5', '36', '0', '1755', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '572', '32', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '63', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1531';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 572, 0, 0
                    , 210.00, -32, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2022-02-24*210.00," WHERE transferproductid = 1756;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '1', '32', '1', '1756', 'تحويل منتجات من المخزن', 'storemovementController.php', '95.00', '63', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('572', '5', '32', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 572, 0, 0
                    , 210.00, 32, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '5', '32', '0', '1756', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '32', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '569', '36', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '171', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1528';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 569, 0, 0
                    , 210.00, -36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*210.00," WHERE transferproductid = 1757;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '1', '36', '1', '1757', 'تحويل منتجات من المخزن', 'storemovementController.php', '207.00', '171', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('569', '5', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 569, 0, 0
                    , 210.00, 36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '5', '36', '0', '1757', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '571', '28', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '178', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1530';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 571, 0, 0
                    , 210.00, -28, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*210.00," WHERE transferproductid = 1758;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '28', '1', '1758', 'تحويل منتجات من المخزن', 'storemovementController.php', '206.00', '178', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('571', '5', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 571, 0, 0
                    , 210.00, 28, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '5', '28', '0', '1758', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '181', '37', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '98', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '181';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 181, 0, 0
                    , 195.00, -37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "37*2022-02-24*195.00," WHERE transferproductid = 1759;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '1', '37', '1', '1759', 'تحويل منتجات من المخزن', 'storemovementController.php', '135.00', '98', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('181', '5', '37', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 181, 0, 0
                    , 195.00, 37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '5', '37', '0', '1759', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '669', '31', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '111', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1953';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 669, 0, 0
                    , 180.00, -31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*180.00," WHERE transferproductid = 1760;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '1', '31', '1', '1760', 'تحويل منتجات من المخزن', 'storemovementController.php', '142.00', '111', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('669', '5', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 669, 0, 0
                    , 180.00, 31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('669', '5', '31', '0', '1760', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '671', '21', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1955';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 671, 0, 0
                    , 180.00, -21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 180.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-02-24*180.00," WHERE transferproductid = 1761;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '1', '21', '1', '1761', 'تحويل منتجات من المخزن', 'storemovementController.php', '41.00', '20', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('671', '5', '21', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 671, 0, 0
                    , 180.00, 21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('671', '5', '21', '0', '1761', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '574', '21', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1534';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 574, 0, 0
                    , 185.00, -21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-02-24*185.00," WHERE transferproductid = 1762;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('574', '1', '21', '1', '1762', 'تحويل منتجات من المخزن', 'storemovementController.php', '21.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('574', '5', '21', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 574, 0, 0
                    , 185.00, 21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('574', '5', '21', '0', '1762', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '681', '26', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1965';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 681, 0, 0
                    , 155.00, -26, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 155.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-02-24*155.00," WHERE transferproductid = 1763;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '1', '26', '1', '1763', 'تحويل منتجات من المخزن', 'storemovementController.php', '256.00', '230', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('681', '5', '26', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 681, 0, 0
                    , 155.00, 26, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('681', '5', '26', '0', '1763', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '26', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '416', '22', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '416';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 416, 0, 0
                    , 140.00, -22, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2022-02-24*140.00," WHERE transferproductid = 1764;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '22', '1', '1764', 'تحويل منتجات من المخزن', 'storemovementController.php', '110.00', '88', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('416', '5', '22', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 416, 0, 0
                    , 140.00, 22, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '5', '22', '0', '1764', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '637', '39', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1915';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 637, 0, 0
                    , 185.00, -39, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-39, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "39*2022-02-24*185.00," WHERE transferproductid = 1765;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '1', '39', '1', '1765', 'تحويل منتجات من المخزن', 'storemovementController.php', '76.00', '37', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('637', '5', '39', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 637, 0, 0
                    , 185.00, 39, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+39, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('637', '5', '39', '0', '1765', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '39', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '660', '23', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1941';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 660, 0, 0
                    , 205.00, -23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*205.00," WHERE transferproductid = 1766;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '1', '23', '1', '1766', 'تحويل منتجات من المخزن', 'storemovementController.php', '24.00', '1', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('660', '5', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 660, 0, 0
                    , 205.00, 23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('660', '5', '23', '0', '1766', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '658', '23', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1939';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 658, 0, 0
                    , 215.00, -23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 215.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*215.00," WHERE transferproductid = 1767;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '1', '23', '1', '1767', 'تحويل منتجات من المخزن', 'storemovementController.php', '31.00', '8', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('658', '5', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 658, 0, 0
                    , 215.00, 23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('658', '5', '23', '0', '1767', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '662', '30', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1943';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 662, 0, 0
                    , 185.00, -30, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2022-02-24*185.00," WHERE transferproductid = 1768;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('662', '1', '30', '1', '1768', 'تحويل منتجات من المخزن', 'storemovementController.php', '34.00', '4', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('662', '5', '30', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 662, 0, 0
                    , 185.00, 30, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('662', '5', '30', '0', '1768', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '647', '33', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1927';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 647, 0, 0
                    , 280.00, -33, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 280.00,
                        buyQuantity =buyQuantity+-33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "33*2022-02-24*280.00," WHERE transferproductid = 1769;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '1', '33', '1', '1769', 'تحويل منتجات من المخزن', 'storemovementController.php', '149.00', '116', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('647', '5', '33', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 647, 0, 0
                    , 280.00, 33, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('647', '5', '33', '0', '1769', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '33', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '645', '29', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '92', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1925';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 645, 0, 0
                    , 205.00, -29, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 205.00,
                        buyQuantity =buyQuantity+-29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "29*2022-02-24*205.00," WHERE transferproductid = 1770;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '1', '29', '1', '1770', 'تحويل منتجات من المخزن', 'storemovementController.php', '121.00', '92', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('645', '5', '29', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 645, 0, 0
                    , 205.00, 29, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+29, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('645', '5', '29', '0', '1770', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '29', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '643', '31', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1923';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 643, 0, 0
                    , 170.00, -31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*170.00," WHERE transferproductid = 1771;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '1', '31', '1', '1771', 'تحويل منتجات من المخزن', 'storemovementController.php', '57.00', '26', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('643', '5', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 643, 0, 0
                    , 170.00, 31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('643', '5', '31', '0', '1771', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '641', '37', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1920';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 641, 0, 0
                    , 140.00, -37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "37*2022-02-24*140.00," WHERE transferproductid = 1772;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('641', '1', '37', '1', '1772', 'تحويل منتجات من المخزن', 'storemovementController.php', '42.00', '5', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('641', '5', '37', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 641, 0, 0
                    , 140.00, 37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('641', '5', '37', '0', '1772', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '678', '24', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '200', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1962';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 678, 0, 0
                    , 145.00, -24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*145.00," WHERE transferproductid = 1773;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '1', '24', '1', '1773', 'تحويل منتجات من المخزن', 'storemovementController.php', '224.00', '200', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('678', '5', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 678, 0, 0
                    , 145.00, 24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('678', '5', '24', '0', '1773', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '664', '24', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '199', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1948';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 664, 0, 0
                    , 140.00, -24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 140.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*140.00," WHERE transferproductid = 1774;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '1', '24', '1', '1774', 'تحويل منتجات من المخزن', 'storemovementController.php', '223.00', '199', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('664', '5', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 664, 0, 0
                    , 140.00, 24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('664', '5', '24', '0', '1774', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '674', '23', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1958';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 674, 0, 0
                    , 145.00, -23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 145.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2022-02-24*145.00," WHERE transferproductid = 1775;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '1', '23', '1', '1775', 'تحويل منتجات من المخزن', 'storemovementController.php', '49.00', '26', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('674', '5', '23', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 674, 0, 0
                    , 145.00, 23, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('674', '5', '23', '0', '1775', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '656', '31', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '134', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1937';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 656, 0, 0
                    , 200.00, -31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*200.00," WHERE transferproductid = 1776;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '1', '31', '1', '1776', 'تحويل منتجات من المخزن', 'storemovementController.php', '165.00', '134', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('656', '5', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 656, 0, 0
                    , 200.00, 31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('656', '5', '31', '0', '1776', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '593', '28', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '97', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1610';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 593, 0, 0
                    , 200.00, -28, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2022-02-24*200.00," WHERE transferproductid = 1777;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '1', '28', '1', '1777', 'تحويل منتجات من المخزن', 'storemovementController.php', '125.00', '97', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('593', '5', '28', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 593, 0, 0
                    , 200.00, 28, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('593', '5', '28', '0', '1777', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '666', '36', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '64', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1950';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 666, 0, 0
                    , 200.00, -36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2022-02-24*200.00," WHERE transferproductid = 1778;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('666', '1', '36', '1', '1778', 'تحويل منتجات من المخزن', 'storemovementController.php', '100.00', '64', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('666', '5', '36', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 666, 0, 0
                    , 200.00, 36, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('666', '5', '36', '0', '1778', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '36', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '738', '24', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '156', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2150';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 738, 0, 0
                    , 190.00, -24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*190.00," WHERE transferproductid = 1779;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '1', '24', '1', '1779', 'تحويل منتجات من المخزن', 'storemovementController.php', '180.00', '156', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('738', '5', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 738, 0, 0
                    , 190.00, 24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('738', '5', '24', '0', '1779', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '739', '24', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '165', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2151';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 739, 0, 0
                    , 190.00, -24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 190.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*190.00," WHERE transferproductid = 1780;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '1', '24', '1', '1780', 'تحويل منتجات من المخزن', 'storemovementController.php', '189.00', '165', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('739', '5', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 739, 0, 0
                    , 190.00, 24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('739', '5', '24', '0', '1780', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '123', '37', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '200', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '123';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 123, 0, 0
                    , 200.00, -37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 200.00,
                        buyQuantity =buyQuantity+-37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "37*2022-02-24*200.00," WHERE transferproductid = 1781;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '37', '1', '1781', 'تحويل منتجات من المخزن', 'storemovementController.php', '237.00', '200', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('123', '5', '37', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 123, 0, 0
                    , 200.00, 37, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+37, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '5', '37', '0', '1781', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '37', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '17', '21', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '17';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 17, 0, 0
                    , 185.00, -21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-02-24*185.00," WHERE transferproductid = 1782;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '1', '21', '1', '1782', 'تحويل منتجات من المخزن', 'storemovementController.php', '44.00', '23', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('17', '5', '21', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 17, 0, 0
                    , 185.00, 21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '5', '21', '0', '1782', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '22', '21', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '98', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '22';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 22, 0, 0
                    , 175.00, -21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 175.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2022-02-24*175.00," WHERE transferproductid = 1783;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '1', '21', '1', '1783', 'تحويل منتجات من المخزن', 'storemovementController.php', '119.00', '98', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('22', '5', '21', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 22, 0, 0
                    , 175.00, 21, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '5', '21', '0', '1783', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '635', '31', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '180', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1912';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 635, 0, 0
                    , 210.00, -31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "31*2022-02-24*210.00," WHERE transferproductid = 1784;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '1', '31', '1', '1784', 'تحويل منتجات من المخزن', 'storemovementController.php', '211.00', '180', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('635', '5', '31', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 635, 0, 0
                    , 210.00, 31, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+31, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('635', '5', '31', '0', '1784', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '31', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '747', '24', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '228', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2166';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 747, 0, 0
                    , 195.00, -24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "24*2022-02-24*195.00," WHERE transferproductid = 1785;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '1', '24', '1', '1785', 'تحويل منتجات من المخزن', 'storemovementController.php', '252.00', '228', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('747', '5', '24', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 747, 0, 0
                    , 195.00, 24, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('747', '5', '24', '0', '1785', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '24', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '748', '26', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '232', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2167';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 748, 0, 0
                    , 185.00, -26, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "26*2022-02-24*185.00," WHERE transferproductid = 1786;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '1', '26', '1', '1786', 'تحويل منتجات من المخزن', 'storemovementController.php', '258.00', '232', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('748', '5', '26', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 748, 0, 0
                    , 185.00, 26, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+26, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('748', '5', '26', '0', '1786', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '26', '1', '2022-02-24','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '765', '20', '2022-02-24', '1', '0','264',null,null,'2022-02-24 21:21:33',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2200';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 1, 765, 0, 0
                    , 220.00, -20, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2022-02-24*220.00," WHERE transferproductid = 1787;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '1', '20', '1', '1787', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2022-02-24','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('765', '5', '20', '1', '2022-02-24');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 765, 0, 0
                    , 220.00, 20, 0, 0, 1, '2022-02-24 21:21:33')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:21:33' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '5', '20', '0', '1787', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:51:34";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:21:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:21:34', '1', 'editorder', '156.210.120.130', '', '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 < "2022-02-24 17:57:45";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:27:45", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 21:27:45', '8', '', '154.176.108.55', '', '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 < "2022-02-24 17:57:46";
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 < "2022-02-24 17:57:49";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:27:49", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 21:27:49', '8', '', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:59:08";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:29:08", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 21:29:08', '8', 'add', '154.176.108.55', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'مواسير حديد', '', '120', '2022-02-24', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '2140',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2260.00','120', '1', '6', 'إضافة مصروف', '407', '2140', '2022-02-24 21:29:08', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '120', '120', '2022-02-24', '8', '0', '0', '2022-02-24 21:29:08','اضافة اسم مصروف( مواسير حديد )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1573', '160', '120', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-87675', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1573', '140', '120', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-47745', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'مواسير حديد', expensesdetails = '', expensesValue = '120.00', expensesdate = '2022-02-24', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '1573', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '407';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:59:08";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:29:08", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 21:29:09', '8', 'sucess', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:59:10";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:29:10", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 21:29:10', '8', 'show', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:59:13";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:29:13", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 21:29:13', '8', '', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 17:59:21";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:29:21", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:29:21', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:00:29";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:30:29", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:30:29', '8', 'addAndRetuen', '154.176.108.55', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217dc91a92fb
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 21:29:21', '06217dc91a92fb', '1', '0.00', '0', '10', '1', '260', '250', '250', '0', '6', '2022-02-24 21:30:29', '', '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','اضافة فاتورة مبيعات','1138', '0', '2022-02-24 21:30:29', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '250', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1854;
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 ('150','00565', '1138', '1', '565', '1', '260', '260', '0', '', '1', '2022-02-24 21:30:29', '565', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','1854-1,');
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
                where sellbilldetailid = 2403;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (565, '2022-02-24', 250, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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, '2022-02-24', 250, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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 = '16', userid = '8', storedetaildate = '2022-02-24 21:30:29' WHERE storedetailid = '1489';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '6', '1', '1', '1138', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17.00', '16', '8', '2022-02-24 21:30:29','0','0');
UPDATE save SET  savecurrentvalue = '2390',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2140.00','250', '0', '6', 'اضافة فاتورة مبيعات', '1138', '2390', '2022-02-24 21:30:29', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 250, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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, '2022-02-24', 250, 150, 150
                    , 150, 150, 150, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , 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, 150, 150
                    , 150, 150, 150, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+250, netSellCostBuyPrice = netSellCostBuyPrice+150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+150
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+150
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217dc91a92fb and sellbillId = 1138 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:00:30";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:30:30", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:30:30', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:00:51";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:30:51", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:30:51', '8', 'addAndRetuen', '154.176.108.55', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217dcd63bcb4
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 21:30:30', '06217dcd63bcb4', '1', '0.00', '0', '15', '1', '265', '250', '250', '0', '6', '2022-02-24 21:30:51', '', '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','اضافة فاتورة مبيعات','1139', '0', '2022-02-24 21:30:51', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '250', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2054;
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', '1139', '1', '590', '1', '265', '265', '0', '', '1', '2022-02-24 21:30:51', '590', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','2054-1,');
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
                where sellbilldetailid = 2404;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (590, '2022-02-24', 250, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 (6, '2022-02-24', 250, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 = '11', userid = '8', storedetaildate = '2022-02-24 21:30:51' WHERE storedetailid = '1584';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('590', '6', '1', '1', '1139', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12.00', '11', '8', '2022-02-24 21:30:51','0','0');
UPDATE save SET  savecurrentvalue = '2640',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2390.00','250', '0', '6', 'اضافة فاتورة مبيعات', '1139', '2640', '2022-02-24 21:30:51', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 250, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2022-02-24', 250, 230, 230
                    , 230, 230, 230, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 250, 230, 230
                    , 230, 230, 230, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+250, netSellCostBuyPrice = netSellCostBuyPrice+230
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+230
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+230
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+230
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+230
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217dcd63bcb4 and sellbillId = 1139 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:00:51";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:30:51", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:30:51', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:10";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:10", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:11', '8', 'addAndRetuen', '154.176.108.55', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217dcebca84f
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 21:30:51', '06217dcebca84f', '1', '0.00', '0', '5', '1', '255', '250', '250', '0', '6', '2022-02-24 21:31:11', '', '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','اضافة فاتورة مبيعات','1140', '0', '2022-02-24 21:31:11', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '250', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2022;
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','00585', '1140', '1', '585', '1', '255', '255', '0', '', '1', '2022-02-24 21:31:11', '585', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','2022-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 2405;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (585, '2022-02-24', 250, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 (6, '2022-02-24', 250, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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 = '23', userid = '8', storedetaildate = '2022-02-24 21:31:11' WHERE storedetailid = '1577';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '6', '1', '1', '1140', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24.00', '23', '8', '2022-02-24 21:31:11','0','0');
UPDATE save SET  savecurrentvalue = '2890',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2640.00','250', '0', '6', 'اضافة فاتورة مبيعات', '1140', '2890', '2022-02-24 21:31:11', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 250, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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, '2022-02-24', 250, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, 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, 250, 220, 220
                    , 220, 220, 220, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+250, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217dcebca84f and sellbillId = 1140 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:11";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:11", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:11', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:37";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:37", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:37', '8', 'addAndRetuen', '154.176.108.55', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217dcff850f5
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 21:31:11', '06217dcff850f5', '1', '0.00', '0', '0', '1', '210', '210', '210', '0', '6', '2022-02-24 21:31:38', '', '8', '0', 'نقدي', '6', '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 = '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','اضافة فاتورة مبيعات','1141', '0', '2022-02-24 21:31:38', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '210', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 996;
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','00515', '1141', '1', '515', '1', '210', '210', '0', '', '0', '2022-02-24 21:31:38', '515', '0.00', '0', '6','0','','','0','0','0','0','0','0','0','0','','996-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 2406;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (515, '2022-02-24', 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 (6, '2022-02-24', 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 = '23', userid = '8', storedetaildate = '2022-02-24 21:31:38' WHERE storedetailid = '1049';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '6', '1', '1', '1141', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24.00', '23', '8', '2022-02-24 21:31:38','0','0');
UPDATE save SET  savecurrentvalue = '3100',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2890.00','210', '0', '6', 'اضافة فاتورة مبيعات', '1141', '3100', '2022-02-24 21:31:38', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 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, '2022-02-24', 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 06217dcff850f5 and sellbillId = 1141 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:38";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:38", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:38', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:54";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:54", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:54', '8', 'addAndRetuen', '154.176.108.55', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06217dd1a6a5fc
-- ----------------------------------------------------------------------------------------------------

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 ('2022-02-24 21:31:38', '06217dd1a6a5fc', '1', '0.00', '0', '0', '1', '255', '255', '255', '0', '6', '2022-02-24 21:31:54', '', '8', '0', 'نقدي', '6', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','255','0','','0','0','255','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','اضافة فاتورة مبيعات','1142', '0', '2022-02-24 21:31:54', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '255', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2022;
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','00585', '1142', '1', '585', '1', '255', '255', '0', '', '1', '2022-02-24 21:31:54', '585', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','2022-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 2407;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (585, '2022-02-24', 255, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, 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 (6, '2022-02-24', 255, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, 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 = '22', userid = '8', storedetaildate = '2022-02-24 21:31:54' WHERE storedetailid = '1577';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '6', '1', '1', '1142', 'اضافة فاتورة مبيعات', 'sellbillController.php', '23.00', '22', '8', '2022-02-24 21:31:54','0','0');
UPDATE save SET  savecurrentvalue = '3355',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3100.00','255', '0', '6', 'اضافة فاتورة مبيعات', '1142', '3355', '2022-02-24 21:31:54', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2022-02-24', 255, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, 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, '2022-02-24', 255, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, 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, 255, 220, 220
                    , 220, 220, 220, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+255, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06217dd1a6a5fc and sellbillId = 1142 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:54";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:54", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 21:31:54', '8', 'addsellBill', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:01:58";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:31:58", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 21:31:58', '8', '', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:02:48";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:32:49", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 21:32:49', '8', '', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:03:03";
UPDATE user SET loginip = "154.176.108.55", lastactivetime = "2022-02-24 21:33:03", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 21:33:03', '8', '', '154.176.108.55', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:03:09";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:33:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 21:33:09', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '69', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '2200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('765', '1', '69', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '69', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:03:11";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:33:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 21:33:11', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:03:53";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:33:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2022-02-24 21:33:53', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:15:25";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:45:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:45:25', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:16:19";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:46:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:46:19', '1', 'add', '156.210.120.130', '', '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(266,3,5,385,6,'2022-02-24',1,0, '' ,0,0,0,0,0,'2022-02-24 21:46:19',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1445';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 3, 385, 0, 0
                    , 185.00, 2, 0, 0, 1, '2022-02-24 21:46:19')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-2, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:46:19' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 3, 385, 0, 0
                    , 185.00, -4, 0, 0, 1, '2022-02-24 21:46:19')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:46:19' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "2*2021-11-08*185.00,4*2022-02-24*185.00," WHERE transferproductid = 1788;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '3', '6', '1', '1788', 'تحويل منتجات من المخزن', 'storemovementController.php', '31.00', '25', '1', '2022-02-24','0','0');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '901';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-08', 5, 385, 0, 0
                    , 185.00, 2, 0, 0, 1, '2022-02-24 21:46:19')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:46:19' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2022-02-24', 5, 385, 0, 0
                    , 185.00, 4, 0, 0, 1, '2022-02-24 21:46:19')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2022-02-24 21:46:19' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '5', '6', '0', '1788', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '8', '1', '2022-02-24','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:16:19";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:46:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:46:19', '1', 'sucess', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:16:21";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 21:46:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2022-02-24 21:46:21', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:42:06";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:12:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 22:12:06', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:45:05";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:15:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:15:05', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:46:04";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:16:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:16:04', '7', 'add', '197.192.204.50', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'عماد حمدي', '', '80', '2022-02-24', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '660',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('740.00','80', '1', '5', 'إضافة مصروف', '408', '660', '2022-02-24 22:16:04', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '80', '80', '2022-02-24', '7', '0', '0', '2022-02-24 22:16:04','اضافة اسم مصروف( عماد حمدي )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1574', '145', '80', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '69980', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1574', '139', '80', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-105664', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'عماد حمدي', expensesdetails = '', expensesValue = '80.00', expensesdate = '2022-02-24', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '1574', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '408';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:46:04";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:16:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:16:05', '7', 'sucess', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:46:06";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:16:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:16:06', '7', 'show', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:46:07";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:16:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 22:16:07', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:48:37";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:18:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:18:37', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:48:58";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:18:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:18:58', '7', 'add', '197.192.204.50', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'عماد حمدي', '', '100', '2022-02-24', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '560',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('660.00','100', '1', '5', 'إضافة مصروف', '409', '560', '2022-02-24 22:18:58', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '100', '100', '2022-02-24', '7', '0', '0', '2022-02-24 22:18:58','اضافة اسم مصروف( عماد حمدي )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1575', '145', '100', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '70080', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1575', '139', '100', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-105764', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'عماد حمدي', expensesdetails = '', expensesValue = '100.00', expensesdate = '2022-02-24', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '1575', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '409';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:48:58";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:18:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:18:59', '7', 'sucess', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:49:00";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:19:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:19:01', '7', 'show', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:49:11";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:19:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 22:19:11', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:50:54";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:20:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 22:20:54', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:55:55";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:25:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2022-02-24 22:25:55', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:57:14";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:27:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2022-02-24 22:27:14', '1', 'add', '156.210.120.130', '', '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 =1777
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(16,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '190050.8' , clientdate = '2022-02-24 22:27:14', userid = '1' WHERE clientid = '16';
UPDATE client SET  inUse = 0 where clientid = 16;
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 ('16','190030.80','-20','1','ايصال تحصيل (( قبض من عميل ))','1777', '190050.8', '2022-02-24 22:25:55', '1', 'clientPayedDeptController.php', '   ظروف شيكات مرتدة شحن من المحلة', '-20', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '442595',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('442615.00','-20', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '1777', '442595', '2022-02-24 22:27:14', '1',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '-20', '-20', '2022-02-24', '1', '0', '0', '2022-02-24 22:27:14','اضافة ايصال سداد للعميل ميدو','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1576', '54', '-20', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '447704', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1576', '69', '-20', '','0');
UPDATE accountstree SET name = 'ميدو', customName = 'ميدو', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-54675', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '69';
UPDATE clientdebtchange SET clientid = '16', clientdebtchangebefore = '190030.80', clientdebtchangeamount = '-20.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '1777', clientdebtchangeafter = '190050.80', clientdebtchangedate = '2022-02-24 22:25:55', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ظروف شيكات مرتدة شحن من المحلة', totalOperationCost = '-20.00',discount='', reciptid=null, dailyentryid = '1576',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '1777';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:57:15";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:27:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2022-02-24 22:27:15', '1', 'sucess', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:57:16";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:27:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2022-02-24 22:27:17', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:58:01";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:28:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 22:28:01', '1', '', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:59:06";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:29:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 22:29:06', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1575';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '3', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:59:08";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:29:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 22:29:08', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:59:56";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:29:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 22:29:56', '1', 'add', '156.210.120.130', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2022-02-24' WHERE storedetailid = '1501';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '3', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '31.00', '32', '1', '2022-02-24','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 18:59:58";
UPDATE user SET loginip = "156.210.120.130", lastactivetime = "2022-02-24 22:29:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2022-02-24 22:29:58', '1', 'show', '156.210.120.130', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:11:26";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 22:41:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 22:41:26', '7', 'addsellBill', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:23:46";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 22:53:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:53:46', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:24:03";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 22:54:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:54:03', '5', 'add', '197.55.81.24', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('6', 'اكياس كبيره', '', '25', '2022-02-24', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '90',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('115.00','25', '1', '3', 'إضافة مصروف', '410', '90', '2022-02-24 22:54:04', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '25', '25', '2022-02-24', '5', '0', '0', '2022-02-24 22:54:04','اضافة اسم مصروف( اكياس كبيره )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1577', '149', '25', '','0');
UPDATE accountstree SET name = 'ادوات مكتبية', customName = 'ادوات مكتبية', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '3702', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '149';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1577', '137', '25', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-63160', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '137';
UPDATE expenses SET expensestypeid = '6', expensesname = 'اكياس كبيره', expensesdetails = '', expensesValue = '25.00', expensesdate = '2022-02-24', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '1577', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '410';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:24:04";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 22:54:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 22:54:04', '5', 'sucess', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:24:05";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 22:54:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2022-02-24 22:54:06', '5', '', '197.55.81.24', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 19:24:20";
UPDATE user SET loginip = "197.55.81.24", lastactivetime = "2022-02-24 22:54:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2022-02-24 22:54:21', '5', 'addsellBill', '197.55.81.24', '', '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 < "2022-02-24 20:19:56";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 23:49:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2022-02-24 23:49:56', '7', '', '197.192.204.50', '', '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 < "2022-02-24 20:19:56";
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 < "2022-02-24 20:20:22";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 23:50:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 23:50:22', '7', '', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 20:20:33";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 23:50:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 23:50:33', '7', 'add', '197.192.204.50', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'محمد ممدوح', '', '300', '2022-02-24', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '260',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('560.00','300', '1', '5', 'إضافة مصروف', '411', '260', '2022-02-24 23:50:33', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '300', '300', '2022-02-24', '7', '0', '0', '2022-02-24 23:50:33','اضافة اسم مصروف( محمد ممدوح )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1578', '145', '300', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '70380', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1578', '139', '300', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-106064', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'محمد ممدوح', expensesdetails = '', expensesValue = '300.00', expensesdate = '2022-02-24', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '1578', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '411';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 20:20:33";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 23:50:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 23:50:33', '7', 'sucess', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2022-02-24 20:20:35";
UPDATE user SET loginip = "197.192.204.50", lastactivetime = "2022-02-24 23:50:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2022-02-24 23:50:35', '7', 'show', '197.192.204.50', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 7;
