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

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:09";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 09:59:09', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:32";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 09:59:32', '4', 'addAndRetuen', '197.61.56.21', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061a5d9ce2108f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2021-11-30 09:59:10', '061a5d9ce2108f', '1', '0.00', '0', '0', '1', '450', '450', '450', '0', '7', '2021-11-30 09:59:32', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','450','0','','0','0','450','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','اضافة فاتورة مبيعات','132', '0', '2021-11-30 09:59:32', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '450', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1948;
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', '132', '1', '515', '1', '230', '230', '0', '', '0', '2021-11-30 09:59:32', '515', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1948-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (515, '2021-11-30', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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 = '9', userid = '4', storedetaildate = '2021-11-30 09:59:32' WHERE storedetailid = '1299';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '7', '1', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10.00', '9', '4', '2021-11-30 09:59:32','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1912;
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','00561', '132', '1', '561', '1', '220', '220', '0', '', '0', '2021-11-30 09:59:32', '561', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1912-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (561, '2021-11-30', 220, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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, '2021-11-30', 220, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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 = '13', userid = '4', storedetaildate = '2021-11-30 09:59:32' WHERE storedetailid = '1515';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '7', '1', '1', '132', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14.00', '13', '4', '2021-11-30 09:59:32','0','0');
UPDATE save SET  savecurrentvalue = '16540',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('16090.00','450', '0', '7', 'اضافة فاتورة مبيعات', '132', '16540', '2021-11-30 09:59:32', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-30', 450, 430, 430
                    , 430, 430, 430, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-30', 450, 430, 430
                    , 430, 430, 430, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , 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, 450, 430, 430
                    , 430, 430, 430, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+450, netSellCostBuyPrice = netSellCostBuyPrice+430
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+430
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+430
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+430
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+430
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061a5d9ce2108f and sellbillId = 132 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:32";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:32", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 09:59:32', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:35";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:35", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-30 09:59:35', '4', '', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:38";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 09:59:39', '4', 'showDetail', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:29:46";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 09:59:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 09:59:46', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 06:44:59";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 10:14:59", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-30 10:14:59', '4', '', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:46:55";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:16:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:16:55', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:47:33";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:17:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:17:33', '4', 'addAndRetuen', '197.61.56.21', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061a5ec07f3dce
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2021-11-30 11:16:56', '061a5ec07f3dce', '1', '0.00', '0', '0', '1', '880', '880', '880', '0', '7', '2021-11-30 11:17:33', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','880','0','','0','0','880','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','اضافة فاتورة مبيعات','133', '0', '2021-11-30 11:17:33', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '880', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1912;
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','00561', '133', '1', '561', '3', '220', '660', '0', '', '0', '2021-11-30 11:17:33', '561', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1912-3,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (561, '2021-11-30', 660, 630, 630
                    , 630, 630, 630, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , 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, '2021-11-30', 660, 630, 630
                    , 630, 630, 630, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '10', userid = '4', storedetaildate = '2021-11-30 11:17:33' WHERE storedetailid = '1515';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '7', '3', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '10', '4', '2021-11-30 11:17:33','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1492;
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','00513', '133', '1', '513', '1', '220', '220', '0', '', '0', '2021-11-30 11:17:33', '513', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1492-1,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (513, '2021-11-30', 220, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, 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, '2021-11-30', 220, 210, 210
                    , 210, 210, 210, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '11', userid = '4', storedetaildate = '2021-11-30 11:17:33' WHERE storedetailid = '1297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '7', '1', '1', '133', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12.00', '11', '4', '2021-11-30 11:17:33','0','0');
UPDATE save SET  savecurrentvalue = '17420',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('16540.00','880', '0', '7', 'اضافة فاتورة مبيعات', '133', '17420', '2021-11-30 11:17:33', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-30', 880, 840, 840
                    , 840, 840, 840, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-30', 880, 840, 840
                    , 840, 840, 840, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 880, 840, 840
                    , 840, 840, 840, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+880, netSellCostBuyPrice = netSellCostBuyPrice+840
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+840
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+840
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+840
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061a5ec07f3dce and sellbillId = 133 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:47:34";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:17:34", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:17:34', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:47:36";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:17:36", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-30 11:17:36', '4', '', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:47:45";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:17:45", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:17:45', '4', 'showDetail', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:47:50";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:17:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:17:50', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:49:10";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:19:10", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:19:10', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:49:46";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:19:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:19:46', '4', 'addAndRetuen', '197.61.56.21', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061a5ec8eb3da3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2021-11-30 11:19:10', '061a5ec8eb3da3', '1', '0.00', '0', '0', '1', '670', '670', '670', '0', '7', '2021-11-30 11:19:46', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '3' ,'0','','','','','-1','0','0','0','0','0','670','0','','0','0','670','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','اضافة فاتورة مبيعات','134', '0', '2021-11-30 11:19:46', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '670', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1948;
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', '134', '1', '515', '1', '230', '230', '0', '', '0', '2021-11-30 11:19:46', '515', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1948-1,');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 310;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (515, '2021-11-30', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, 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 = '8', userid = '4', storedetaildate = '2021-11-30 11:19:46' WHERE storedetailid = '1299';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '7', '1', '1', '134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '8', '4', '2021-11-30 11:19:46','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 1976;
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','00563', '134', '1', '563', '2', '220', '440', '0', '', '0', '2021-11-30 11:19:46', '563', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1976-2,');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 311;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (563, '2021-11-30', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '7', userid = '4', storedetaildate = '2021-11-30 11:19:46' WHERE storedetailid = '1553';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '7', '2', '1', '134', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '7', '4', '2021-11-30 11:19:46','0','0');
UPDATE save SET  savecurrentvalue = '18090',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('17420.00','670', '0', '7', 'اضافة فاتورة مبيعات', '134', '18090', '2021-11-30 11:19:46', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-30', 670, 640, 640
                    , 640, 640, 640, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-30', 670, 640, 640
                    , 640, 640, 640, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+670, sellCostBuyPrice =sellCostBuyPrice+640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640
                            , 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, 670, 640, 640
                    , 640, 640, 640, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+670, netSellCostBuyPrice = netSellCostBuyPrice+640
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+640
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+640
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+640
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+640
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061a5ec8eb3da3 and sellbillId = 134 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:49:46";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:19:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:19:46', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:49:49";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:19:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:19:49', '4', 'addsellBill', '197.61.56.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 07:51:52";
UPDATE user SET loginip = "197.61.56.21", lastactivetime = "2021-11-30 11:21:52", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 11:21:52', '4', 'addAndRetuen', '197.61.56.21', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 061a5ecb556c3c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2021-11-30 11:19:49', '061a5ecb556c3c', '1', '0.00', '0', '0', '1', '1120', '1120', '-1120', '0', '7', '2021-11-30 11:21:52', '', '4', '0', 'نقدي','7', '0', '5', '0', 'نقدي', '5', '0', '', '','','','-1','0','0','0','','0','-1120','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','26', '0', '2021-11-30 11:21:52', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1120', '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 ('220.00', '00515', '26', '1', '515', '2', '230', '460', '0', '', '0', '0', '515', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where returnsellbilldetailid = 39;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (515, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 460, 440, 440, 440
                    , 440, 440, 0, 0, 2)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+460, returnSellCostBuyPrice = returnSellCostBuyPrice+440, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+440
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+440, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+440
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+440
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 460, 440, 440, 440
                    , 440, 440, 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+460, returnSellCostBuyPrice = returnSellCostBuyPrice+440, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+440
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+440, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+440
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+440
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '10', userid = '4', storedetaildate = '2021-11-30 11:21:52' WHERE storedetailid = '1299';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '7', '2', '0', '26', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '8.00', '10', '4', '2021-11-30 11:21:52','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('185.00', '00386', '26', '1', '386', '1', '190', '190', '0', '', '0', '0', '386', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where returnsellbilldetailid = 40;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (386, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 190, 185, 185, 185
                    , 185, 185, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+190, returnSellCostBuyPrice = returnSellCostBuyPrice+185, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+185, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+185
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 190, 185, 185, 185
                    , 185, 185, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+190, returnSellCostBuyPrice = returnSellCostBuyPrice+185, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+185, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+185
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '3', userid = '4', storedetaildate = '2021-11-30 11:21:52' WHERE storedetailid = '1295';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '7', '1', '0', '26', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '2.00', '3', '4', '2021-11-30 11:21:52','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('195.00', '00126', '26', '1', '126', '1', '220', '220', '0', '', '0', '0', '126', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 195.00 , meanbuyprice = 195.00, lastbuyprice_withDiscount = 195.00, meanbuyprice_withDiscount = 195.00
                where returnsellbilldetailid = 41;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (126, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 220, 195, 195, 195
                    , 195, 195, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+220, returnSellCostBuyPrice = returnSellCostBuyPrice+195, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+195
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+195, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+195
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+195
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 220, 195, 195, 195
                    , 195, 195, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+220, returnSellCostBuyPrice = returnSellCostBuyPrice+195, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+195
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+195, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+195
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+195
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '6', userid = '4', storedetaildate = '2021-11-30 11:21:52' WHERE storedetailid = '1308';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('126', '7', '1', '0', '26', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '5.00', '6', '4', '2021-11-30 11:21:52','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('235.00', '00540', '26', '1', '540', '1', '250', '250', '0', '', '0', '0', '540', '0.00', '0','7','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 235.00 , meanbuyprice = 235.00, lastbuyprice_withDiscount = 235.00, meanbuyprice_withDiscount = 235.00
                where returnsellbilldetailid = 42;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (540, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 250, 235, 235, 235
                    , 235, 235, 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+250, returnSellCostBuyPrice = returnSellCostBuyPrice+235, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+235
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+235, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+235
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+235
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 250, 235, 235, 235
                    , 235, 235, 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+250, returnSellCostBuyPrice = returnSellCostBuyPrice+235, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+235
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+235, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+235
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+235
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '4', storedetaildate = '2021-11-30 11:21:52' WHERE storedetailid = '1310';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('540', '7', '1', '0', '26', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '8.00', '9', '4', '2021-11-30 11:21:52','0','0');
UPDATE save SET  savecurrentvalue = '16970',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('18090.00','1120', '1', '7', 'اضافة فاتورة مردوات مبيعات', '26', '16970', '2021-11-30 11:21:52', '4',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1120, 1055, 1055, 1055
                    , 1055, 1055, 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+1120, returnSellCostBuyPrice = returnSellCostBuyPrice+1055, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1055
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1055, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1055
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1055
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-30', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1120, 1055, 1055, 1055
                    , 1055, 1055, 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+1120, returnSellCostBuyPrice = returnSellCostBuyPrice+1055, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1055
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1055, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1055
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1055
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -1120, -1055, -1055
                    , -1055, -1055, -1055, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1120, netSellCostBuyPrice = netSellCostBuyPrice+-1055
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1055
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1055
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1055
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1055
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061a5ecb556c3c and sellbillId = 26 and returnsellbillId = 26
-- ----------------------------------------------------------------------------------------------------

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

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

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

END

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

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:23:45";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 11:53:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 11:53:45', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:24:19";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 11:54:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 11:54:19', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1512';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1511';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '4', '26', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '26.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1510';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '4', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1509';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '4', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1508';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '4', '36', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '36.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1485';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '4', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '4', '0', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '0.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '4', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('218', '4', '33', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '33.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '792';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '4', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '791';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '4', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '4', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '789';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '4', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '4', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '786';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('511', '4', '28', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '28.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('474', '4', '31', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '784';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('461', '4', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '4', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('458', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '781';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('448', '4', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '780';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('442', '4', '150', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '150.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '779';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('404', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '778';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('403', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '4', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('401', '4', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '4', '74', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '74.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('400', '4', '81', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '81.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '772';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '4', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '771';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '769';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '4', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '768';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '4', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '767';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '4', '5', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '766';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '4', '31', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '765';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('325', '4', '84', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '84.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '764';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('324', '4', '82', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '82.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '763';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '4', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '762';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '4', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '761';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('302', '4', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '760';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('301', '4', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '759';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('300', '4', '34', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '34.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '758';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('299', '4', '66', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '66.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '757';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '4', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '756';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '755';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '4', '37', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '37.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '754';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('295', '4', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('294', '4', '31', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('293', '4', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '751';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '4', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '750';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '4', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '749';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('290', '4', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '4.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('289', '4', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '4', '51', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '51.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '746';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('287', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '745';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('286', '4', '27', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '27.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '744';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('285', '4', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '743';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '4', '42', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '42.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '742';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '4', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '741';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('282', '4', '38', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '38.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '740';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('281', '4', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '739';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '738';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '4', '33', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '33.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '737';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('278', '4', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '736';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('277', '4', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '735';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('276', '4', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '734';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '4', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '733';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('274', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '732';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('273', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '731';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('272', '4', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('271', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '729';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('270', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '728';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('269', '4', '30', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '30.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '727';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '4', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '726';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '4', '0', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '0.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '725';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('266', '4', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '724';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('265', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '723';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('264', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '722';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('263', '4', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '721';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '720';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('261', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '719';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('260', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '718';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '4', '32', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '32.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '717';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '4', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '716';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('257', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '715';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('256', '4', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '4.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '714';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('250', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '713';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('248', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '712';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('247', '4', '21', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '21.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '711';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('246', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('245', '4', '30', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '30.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '709';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('244', '4', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '708';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('243', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '707';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '4', '51', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '51.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '706';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('241', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '705';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '704';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '4', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '4.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '703';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('238', '4', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '702';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('237', '4', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '701';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('236', '4', '53', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '53.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '700';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('235', '4', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '699';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '4', '45', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '45.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '698';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('233', '4', '28', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '28.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '697';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('232', '4', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '696';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '4', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '695';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '4', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '694';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '4', '32', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '32.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '693';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('228', '4', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '692';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('227', '4', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '691';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('226', '4', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '690';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('225', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '689';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('224', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '688';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '4', '34', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '34.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '687';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('222', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '686';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '4', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '685';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('220', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('219', '4', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('133', '4', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '682';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('132', '4', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '681';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '680';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '4', '34', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '34.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '4', '32', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '32.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '4', '26', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '26.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '677';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '4', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '676';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('66', '4', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '675';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('36', '4', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '674';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('19', '4', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '673';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '4', '5', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5.00', '0', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:24:29";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 11:54:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 11:54:30', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:38:56";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:08:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:08:56', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '4', '14', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '14', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:38:58";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:08:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:08:58', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:42:04";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:12:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:12:04', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '789';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '4', '14', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '14', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:42:06";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:12:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:12:06', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:43:09";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:13:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:13:10', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('133', '4', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '8', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:43:12";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:13:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:13:12', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:43:39";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:13:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:13:40', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1509';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '4', '9', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '9', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:43:41";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:13:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:13:41', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:45:03";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:15:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:15:03', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '768';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '4', '10', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '10', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:45:05";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:15:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:15:05', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:45:32";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:15:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:15:32', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1510';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '4', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:45:34";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:15:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:15:34', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:46:50";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:16:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:16:50', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '4', '14', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '14', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:46:52";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:16:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:16:52', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:47:23";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:17:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:17:23', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '772';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '4', '10', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '10', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:47:25";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:17:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:17:25', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:47:32";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:17:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 12:17:32', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:47:55";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:17:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:17:55', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:48:35";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:18:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:18:35', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '4', '9', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '9', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:48:37";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:18:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:18:37', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:49:46";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:19:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:19:46', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '127';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '1', '32', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '32', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:49:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:19:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:19:48', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:50:02";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:20:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:20:02', '1', 'add', '41.233.79.98', '', '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(51,1,4,127,32,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:20:02',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '127';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 127, 0, 0
                    , 210.00, -32, 0, 0, 1, '2021-11-30 12:20:03')
                ON DUPLICATE KEY UPDATE buyprice = 210.00,
                        buyQuantity =buyQuantity+-32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:20:03' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "32*2021-11-30*210.00," WHERE transferproductid = 993;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '1', '32', '1', '993', 'تحويل منتجات من المخزن', 'storemovementController.php', '32.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '681';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 127, 0, 0
                    , 210.00, 32, 0, 0, 1, '2021-11-30 12:20:03')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:20:03' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '4', '32', '0', '993', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '32', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:50:03";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:20:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:20:03', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:50:05";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:20:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:20:05', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:50:44";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:20:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:20:45', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '681';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('127', '4', '32', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '32.00', '32', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:50:46";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:20:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:20:47', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:52:40";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:22:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:22:40', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '778';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('403', '4', '4', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '4', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:52:42";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:22:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:22:42', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:53:30";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:23:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:23:30', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '767';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '4', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '8', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:53:32";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:23:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:23:32', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:10";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:24:10', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '129';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '1', '27', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '27', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:12";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:24:12', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:17";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:24:17', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:34";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:24:34', '1', 'add', '41.233.79.98', '', '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(52,1,4,129,27,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:24:34',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '129';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 129, 0, 0
                    , 235.00, -27, 0, 0, 1, '2021-11-30 12:24:34')
                ON DUPLICATE KEY UPDATE buyprice = 235.00,
                        buyQuantity =buyQuantity+-27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:24:34' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2021-11-30*235.00," WHERE transferproductid = 994;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '1', '27', '1', '994', 'تحويل منتجات من المخزن', 'storemovementController.php', '27.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('129', '4', '27', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 129, 0, 0
                    , 235.00, 27, 0, 0, 1, '2021-11-30 12:24:34')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:24:34' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '4', '27', '0', '994', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:34";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:24:34', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:54:40";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:24:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:24:40', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:55:07";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:25:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:25:08', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1559';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('129', '4', '27', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '27.00', '27', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:55:22";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:25:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:25:22', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:55:49";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:25:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:25:49', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1485';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '4', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '2', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:55:51";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:25:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:25:51', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:25";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:27:25', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1554';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '1', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '8', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:27";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:27:27', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:30";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:27:30', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:27:48', '1', 'add', '41.233.79.98', '', '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(53,1,4,585,8,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:27:48',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1554';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 585, 0, 0
                    , 220.00, -8, 0, 0, 1, '2021-11-30 12:27:48')
                ON DUPLICATE KEY UPDATE buyprice = 220.00,
                        buyQuantity =buyQuantity+-8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:27:48' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "8*2021-11-30*220.00," WHERE transferproductid = 995;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '1', '8', '1', '995', 'تحويل منتجات من المخزن', 'storemovementController.php', '8.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('585', '4', '8', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 585, 0, 0
                    , 220.00, 8, 0, 0, 1, '2021-11-30 12:27:48')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+8, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:27:48' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '4', '8', '0', '995', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '8', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:27:48', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:57:55";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:27:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:27:55', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:58:16";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:28:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:28:16', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '4', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '8.00', '8', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:58:18";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:28:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:28:18', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:58:42";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:28:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:28:42', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '4', '19', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '19', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:58:43";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:28:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:28:43', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:59:00";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:29:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:29:00', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:59:01";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:29:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:29:01', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:59:36";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:29:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:29:36', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '253';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '1', '3', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '3', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:59:38";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:29:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:29:38', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 08:59:39";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:29:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:29:39', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:00";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:30:00', '1', 'add', '41.233.79.98', '', '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(54,1,4,253,3,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:30:00',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '253';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 253, 0, 0
                    , 225.00, -3, 0, 0, 1, '2021-11-30 12:30:00')
                ON DUPLICATE KEY UPDATE buyprice = 225.00,
                        buyQuantity =buyQuantity+-3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:30:00' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "3*2021-11-30*225.00," WHERE transferproductid = 996;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '1', '3', '1', '996', 'تحويل منتجات من المخزن', 'storemovementController.php', '3.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('253', '4', '3', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 253, 0, 0
                    , 225.00, 3, 0, 0, 1, '2021-11-30 12:30:00')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:30:00' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '4', '3', '0', '996', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '3', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:02";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:30:02', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:04";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:30:04', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:32";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:30:32', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1561';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '4', '3', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '3.00', '3', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:34";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:30:34', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:00:38";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:30:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:30:38', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:05:25";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:35:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:35:25', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '766';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '4', '32', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '32', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:05:27";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:35:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:35:27', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:06:20";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:36:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:36:20', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '771';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '4', '11', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '11', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:06:22";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:36:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:36:22', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:08:39";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:38:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:38:39', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1511';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '4', '42', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '42', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:08:40";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:38:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:38:40', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:09:00";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:39:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:39:00', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1508';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '4', '34', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '34', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:09:02";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:39:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:39:02', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:12:38";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:42:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:42:38', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '4', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:12:40";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:42:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:42:40', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:13:07";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:43:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:43:07', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '4', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '13.00', '14', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:13:09";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:43:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:43:09', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:13:44";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:43:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:43:44', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '4', '3', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '3', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:13:45";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:43:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:43:45', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:14:20";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:44:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:44:21', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '792';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '4', '7', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '7', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:14:22";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:44:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:44:22', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:14:55";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:44:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:44:55', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '791';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '4', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:14:57";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:44:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:44:57', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:15:19";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:45:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:45:19', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '4', '20', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '20', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:15:21";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:45:21', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:17:43";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:47:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:47:43', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '454';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '1', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:17:44";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:47:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:47:45', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:17:55";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:47:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:47:55', '1', 'add', '41.233.79.98', '', '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(55,1,4,454,13,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:47:55',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '454';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 454, 0, 0
                    , 195.00, -13, 0, 0, 1, '2021-11-30 12:47:55')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:47:55' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "13*2021-11-30*195.00," WHERE transferproductid = 997;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '1', '13', '1', '997', 'تحويل منتجات من المخزن', 'storemovementController.php', '13.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('454', '4', '13', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 454, 0, 0
                    , 195.00, 13, 0, 0, 1, '2021-11-30 12:47:55')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+13, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:47:55' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '4', '13', '0', '997', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '13', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:17:56";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:47:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:47:56', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:17:58";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:47:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:47:58', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:18:00";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:48:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:48:00', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:18:44";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:48:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:48:44', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('454', '4', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '13.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:18:45";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:48:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:48:45', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:31";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:49:31', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '455';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '1', '7', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '7', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:33";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:49:33', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:49:48', '1', 'add', '41.233.79.98', '', '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(56,1,4,455,7,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:49:48',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '455';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 455, 0, 0
                    , 195.00, -7, 0, 0, 1, '2021-11-30 12:49:48')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:49:48' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "7*2021-11-30*195.00," WHERE transferproductid = 998;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '1', '7', '1', '998', 'تحويل منتجات من المخزن', 'storemovementController.php', '7.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('455', '4', '7', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 455, 0, 0
                    , 195.00, 7, 0, 0, 1, '2021-11-30 12:49:48')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+7, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:49:48' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '4', '7', '0', '998', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '7', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:49:48', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:50";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:49:50', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:19:50";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:49:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:49:50', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:20:15";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:50:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:50:15', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('455', '4', '7', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '7.00', '7', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:20:17";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:50:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:50:17', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:20:42";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:50:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:50:42', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '6', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:20:44";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:50:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:50:44', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:21:01";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:51:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:51:01', '1', 'add', '41.233.79.98', '', '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(57,1,4,453,6,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:51:01',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '453';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 453, 0, 0
                    , 195.00, -6, 0, 0, 1, '2021-11-30 12:51:01')
                ON DUPLICATE KEY UPDATE buyprice = 195.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:51:01' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2021-11-30*195.00," WHERE transferproductid = 999;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '6', '1', '999', 'تحويل منتجات من المخزن', 'storemovementController.php', '6.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('453', '4', '6', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 453, 0, 0
                    , 195.00, 6, 0, 0, 1, '2021-11-30 12:51:01')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:51:01' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '4', '6', '0', '999', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '6', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:21:03";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:51:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:51:03', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:21:05";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:51:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:51:05', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:21:19";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:51:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:51:19', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1564';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '4', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '6.00', '6', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:21:21";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:51:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:51:21', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:22:24";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:52:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 12:52:24', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:25:40";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:55:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 12:55:40', '1', 'add', '41.233.79.98', '', '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 ('ديجيتال.قديم','','1','170','175', '205','185', '2021-11-30', '0', '1', '0', '', '0', '0', '0', '0', '0', '170','170','170','170','170','0','2.94','8.82','20.59','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ديجيتال.قديم', productDescription = '', productCatId = '1', productBuyPrice = '170', productSellAllPrice = '175', productSellUnitPrice = '205', productSellHalfPrice = '185', productDate = '2021-11-30', conditions = '0', userId = '1', limitamount = '0', parcode = '00587',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 = '2.94' , buyhalf_precentage = '8.82' , buypart_precentage = '20.59',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '587';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '587', '1', '2021-11-30', '1', '0','0058701','175','185','205','170');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('587', '1', '20', '1', '2021-11-30');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '1', '20', '0', '587', 'إضافة منتج', 'productController.php', '0', '20', '1', '2021-11-30','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (587, 1,'2021-11-30 12:55:41',1)
                ON DUPLICATE KEY UPDATE productid = 587, edited = 1, sysdate = '2021-11-30 12:55:41', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3400', '3400', '2021-11-30', '1', '0', '0', '2021-11-30 12:55:41','إضافة منتج ديجيتال.قديم الكمية 20','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('699', '19', '3400', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6025532.5', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('699', '7', '3400', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '6880478.3', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ديجيتال.قديم', productDescription = '', productCatId = '1', productBuyPrice = '170.00', productSellAllPrice = '175.00', productSellUnitPrice = '205.00', productSellHalfPrice = '185.00', productDate = '2021-11-30', conditions = '0', userId = '1', limitamount = '0', parcode = '00587',type ='0', expireDate = '0' , dailyentryId = '699',isService = '0',isOptic = '0',lastbuyprice = '170',lastbuyprice_withDiscount = '170',meanbuyprice = '170',meanbuyprice_withDiscount = '170' , productbuypricereal = '170' , buypricereal_precentage = '0' , buytotal_precentage = '2.94' , buyhalf_precentage = '8.82' , buypart_precentage = '20.59',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '587';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:25:43";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:55:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 12:55:43', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:25:48";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:55:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:55:48', '1', '', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:26:15";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:56:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:56:15', '1', 'add', '41.233.79.98', '', '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(58,1,4,587,20,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 12:56:16',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1565';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 587, 0, 0
                    , 170.00, -20, 0, 0, 1, '2021-11-30 12:56:16')
                ON DUPLICATE KEY UPDATE buyprice = 170.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:56:16' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2021-11-30*170.00," WHERE transferproductid = 1000;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '1', '20', '1', '1000', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('587', '4', '20', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 4, 587, 0, 0
                    , 170.00, 20, 0, 0, 1, '2021-11-30 12:56:16')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 12:56:16' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '4', '20', '0', '1000', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:26:18";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:56:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:56:19', '1', 'sucess', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:26:21";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:56:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 12:56:21', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:26:35";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:56:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:56:35', '1', 'add', '41.233.79.98', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1566';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '4', '20', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '20.00', '20', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:26:37";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 12:56:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 12:56:37', '1', 'show', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:47:41";
UPDATE user SET loginip = "156.164.217.207", lastactivetime = "2021-11-30 13:17:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 13:17:41', '7', '', '156.164.217.207', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:47:41";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 09:47:49";
UPDATE user SET loginip = "156.164.217.207", lastactivetime = "2021-11-30 13:17:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 13:17:49', '7', 'addsellBill', '156.164.217.207', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:29:30";
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:36:50";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:06:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 14:06:50', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:36:51";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:37:01";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:07:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:07:01', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:37:40";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:07:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:07:40', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1558';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '8', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1543';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1533';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('126', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1526';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '8', '50', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '50.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1521';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('302', '8', '25', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '25.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1520';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '8', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1519';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '8', '29', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '29.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1518';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '8', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '8', '12', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '-12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1486';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '8', '5', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '8', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1477';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '8', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('218', '8', '72', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '72.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1210';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('217', '8', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1209';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('520', '8', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '8', '29', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '29.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '8', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '8', '36', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '36.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1204';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('514', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1203';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '8', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('512', '8', '26', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '26.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1201';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('511', '8', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('476', '8', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('474', '8', '48', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '48.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1198';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('472', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1197';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('159', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1195';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1194';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('464', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1193';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '8', '32', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '32.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1192';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('462', '8', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1191';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('128', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('451', '8', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1189';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('449', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1188';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('442', '8', '219', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '219.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('410', '8', '39', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '39.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('408', '8', '24', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '24.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('405', '8', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1184';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('399', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1183';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('396', '8', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1181';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1180';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1179';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1178';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1176';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('381', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('323', '8', '28', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '28.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('321', '8', '31', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '31.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1173';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('319', '8', '57', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '57.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1172';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '8', '79', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '79.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1171';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '8', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1170';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('8', '8', '34', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '34.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('7', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1167';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('121', '8', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1166';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('119', '8', '5', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1164';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('118', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1163';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1162';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1161';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('114', '8', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1159';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('113', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1158';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '8', '26', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '26.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1157';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1156';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1155';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '8', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1154';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '8', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1153';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '8', '37', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '37.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1152';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '8', '19', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1151';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '8', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1150';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('99', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1149';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('98', '8', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1148';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('97', '8', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1147';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '8', '39', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '39.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('95', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1145';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '8', '18', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '18.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1144';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '8', '27', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '27.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1143';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '8', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1142';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '8', '47', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '47.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1141';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '8', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1140';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '8', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1139';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1138';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1136';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '8', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1135';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '8', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1134';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1133';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1132';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1131';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1130';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('77', '8', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1129';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1128';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('75', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1127';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('74', '8', '23', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '23.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1126';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '8', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1125';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1124';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('72', '8', '11', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '11.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('71', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1122';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1121';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('69', '8', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('68', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1119';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('67', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1118';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('66', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('65', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('64', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('63', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1114';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1113';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('60', '8', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '10.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('58', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('57', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('56', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('55', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1106';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('54', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1104';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '8', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '8', '20', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '20.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '8', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '2.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1099';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '8', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1098';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '8', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1097';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('24', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1096';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('23', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1095';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '8', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '12.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1094';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('22', '8', '0', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '0.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1093';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1092';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1091';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('21', '8', '27', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '27.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1090';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1089';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('40', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1088';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1087';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '8', '7', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '7.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1086';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('19', '8', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1085';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('18', '8', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1084';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '8', '21', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '21.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1083';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1082';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('14', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1081';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('13', '8', '17', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '17.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1080';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '8', '35', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '35.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1079';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('38', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1078';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('37', '8', '26', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '26.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1077';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('36', '8', '55', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '55.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1076';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('35', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1075';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('33', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1074';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '8', '58', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '58.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1073';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('32', '8', '4', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '4.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1072';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('31', '8', '3', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '3.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1071';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('30', '8', '8', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '8.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1070';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '8', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1069';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '8', '16', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '16.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1068';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('303', '8', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '1.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1067';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('313', '8', '13', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '13.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1066';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('311', '8', '22', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '22.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1065';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '8', '14', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '14.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1064';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('106', '8', '5', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5.00', '0', '1', '2021-11-30','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1063';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '8', '15', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '15.00', '0', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:37:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:07:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 14:07:56', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:38:05";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:08:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:08:05', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:38:51";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:08:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:08:51', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:42:37";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:12:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:12:37', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1477';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '8', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '15', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:42:39";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:12:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:12:39', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:43:18";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:13:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:13:18', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1519';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('565', '8', '25', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '25', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:43:20";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:13:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:13:20', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:44:07";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:14:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:14:07', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1178';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '8', '11', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '11', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:44:09";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:14:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:14:09', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:45:02";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:15:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:15:02', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1181';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '8', '9', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '9', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:45:04";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:15:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:15:04', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:45:32";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:15:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:15:32', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '8', '33', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '33', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:45:34";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:15:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:15:34', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:46:03";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:16:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:16:03', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1520';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '8', '27', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '27', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:46:05";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:16:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:16:05', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:46:47";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:16:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:16:47', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1486';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '8', '12', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '12', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:46:49";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:16:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:16:50', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:47:12";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:17:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:17:12', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '8', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '18', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:47:14";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:17:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:17:14', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:47:36";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:17:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:17:36', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1518';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '8', '30', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '30', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:47:38";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:17:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:17:38', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:59:08";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:29:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:29:08', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1193';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('463', '8', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '15', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 10:59:10";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:29:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:29:10', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:00:35";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:30:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:30:35', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('382', '8', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '18', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:00:37";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:30:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:30:37', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:00:59";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:30:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:30:59', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1179';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('384', '8', '5', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '5', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:01:01";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:31:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:31:01', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:14:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:44:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:44:55', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1533';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('126', '8', '27', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '27', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:14:57";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:44:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:44:57', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:17:22";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:47:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:47:22', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1533';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('126', '8', '11', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '27.00', '38', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:17:24";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:47:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:47:24', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:18:00";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:48:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:48:01', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1195';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '8', '13', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '13', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:18:02";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:48:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:48:02', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:23:41";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:53:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 14:53:41', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:24:21";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:54:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 14:54:21', '1', 'add', '156.201.68.237', '', '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 ('436','','1','185','190', '220','200', '2021-11-30', '0', '1', '0', '', '0', '0', '0', '0', '0', '185','185','185','185','185','0','2.7','8.11','18.92','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '436', productDescription = '', productCatId = '1', productBuyPrice = '185', productSellAllPrice = '190', productSellUnitPrice = '220', productSellHalfPrice = '200', productDate = '2021-11-30', conditions = '0', userId = '1', limitamount = '0', parcode = '00588',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 = '2.7' , buyhalf_precentage = '8.11' , buypart_precentage = '18.92',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '588';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '588', '1', '2021-11-30', '1', '0','0058801','190','200','220','185');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('588', '1', '15', '1', '2021-11-30');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('588', '1', '15', '0', '588', 'إضافة منتج', 'productController.php', '0', '15', '1', '2021-11-30','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (588, 1,'2021-11-30 14:54:21',1)
                ON DUPLICATE KEY UPDATE productid = 588, edited = 1, sysdate = '2021-11-30 14:54:21', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2775', '2775', '2021-11-30', '1', '0', '0', '2021-11-30 14:54:21','إضافة منتج 436 الكمية 15','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('700', '19', '2775', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '6028307.5', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('700', '7', '2775', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '6883253.3', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = '436', productDescription = '', productCatId = '1', productBuyPrice = '185.00', productSellAllPrice = '190.00', productSellUnitPrice = '220.00', productSellHalfPrice = '200.00', productDate = '2021-11-30', conditions = '0', userId = '1', limitamount = '0', parcode = '00588',type ='0', expireDate = '0' , dailyentryId = '700',isService = '0',isOptic = '0',lastbuyprice = '185',lastbuyprice_withDiscount = '185',meanbuyprice = '185',meanbuyprice_withDiscount = '185' , productbuypricereal = '185' , buypricereal_precentage = '0' , buytotal_precentage = '2.7' , buyhalf_precentage = '8.11' , buypart_precentage = '18.92',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '588';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:24:24";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:54:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-30 14:54:24', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:24:42";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:54:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 14:54:42', '1', 'add', '156.201.68.237', '', '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(59,1,8,588,15,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 14:54:42',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1567';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 588, 0, 0
                    , 185.00, -15, 0, 0, 1, '2021-11-30 14:54:42')
                ON DUPLICATE KEY UPDATE buyprice = 185.00,
                        buyQuantity =buyQuantity+-15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 14:54:42' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2021-11-30*185.00," WHERE transferproductid = 1001;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('588', '1', '15', '1', '1001', 'تحويل منتجات من المخزن', 'storemovementController.php', '15.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('588', '8', '15', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 8, 588, 0, 0
                    , 185.00, 15, 0, 0, 1, '2021-11-30 14:54:42')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 14:54:42' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('588', '8', '15', '0', '1001', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '15', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:24:44";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:54:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 14:54:44', '1', 'sucess', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:24:46";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:54:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 14:54:46', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:25:20";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:55:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:55:21', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1568';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('588', '8', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '15.00', '15', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:25:22";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:55:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:55:23', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:25:43";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:55:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:55:43', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '8', '10', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '10', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:25:45";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:55:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:55:45', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:26:43";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:56:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:56:43', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '8', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '15', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:26:45";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:56:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:56:45', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:27:03";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:57:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:57:03', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1203';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '8', '23', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '23', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:27:05";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 14:57:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 14:57:05', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:28:54";
UPDATE user SET loginip = "41.232.83.242", lastactivetime = "2021-11-30 14:58:55", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-30 14:58:55', '4', '', '41.232.83.242', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:29:18";
UPDATE user SET loginip = "154.176.135.217", lastactivetime = "2021-11-30 14:59:18", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 14:59:18', '8', '', '154.176.135.217', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:29: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 < "2021-11-30 11:29:24";
UPDATE user SET loginip = "154.176.135.217", lastactivetime = "2021-11-30 14:59:24", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 14:59:24', '8', 'addsellBill', '154.176.135.217', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:30:56";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:00:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:00:56', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '8', '32', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '32', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:30:58";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:00:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:00:58', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:32:40";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:02:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:02:40', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '8', '28', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '28', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:32:42";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:02:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:02:42', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:33:48";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:03:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:03:48', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('515', '8', '31', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '31', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:33:50";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:03:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:03:50', '1', 'show', '156.201.68.237', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:33:54";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 15:03:54", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 15:03:54', '6', '', '41.233.79.98', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:33:54";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:33:59";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 15:03:59", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2021-11-30 15:03:59', '6', 'edit', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:34:39";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 15:04:39", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 15:04:39', '6', 'addsellBill', '41.233.79.98', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:34:43";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:04:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:04:43', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1192';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('462', '8', '14', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '14', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:34:45";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:04:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:04:45', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:35:19";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:05:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:05:19', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '8', '17', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '17', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:35:21";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:05:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:05:21', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:36:53";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:06:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:06:53', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '8', '9', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '32.00', '41', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:36:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:06:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:06:55', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:37:32";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:07:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:07:32', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1191';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('128', '8', '12', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '12', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:37:34";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:07:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:07:34', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:39:04";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:09:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:09:04', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '8', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '41.00', '39', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:39:06";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:09:06', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:41:03";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:11:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 15:11:03', '3', '', '156.201.68.237', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:41:03";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:42:19";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:12:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-30 15:12:19', '3', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:42:26";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:12:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-30 15:12:26', '3', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:44:28";
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:44:56";
UPDATE user SET loginip = "" WHERE userid = 3;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:45:10";
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:45:20";
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:48:52";
UPDATE user SET loginip = "41.233.79.98", lastactivetime = "2021-11-30 15:18:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 15:18:52', '6', 'addsellBill', '41.233.79.98', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:53:44";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:23:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 15:23:45', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:53:45";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:54:06";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:24:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:24:06', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:55:14";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:25:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:25:14', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1119';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('67', '8', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '6', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 11:55:16";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:25:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:25:16', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:01:23";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:31:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 15:31:24', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:02:13";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:32:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:32:13', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '216';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('216', '1', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '18', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:02:15";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:32:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:32:15', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:02:34";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:32:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 15:32:34', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:02:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:32:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 15:32:55', '1', 'add', '156.201.68.237', '', '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(60,1,8,216,18,'2021-11-30',1,0, '' ,0,0,0,0,0,'2021-11-30 15:32:55',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '216';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 1, 216, 0, 0
                    , 160.00, -18, 0, 0, 1, '2021-11-30 15:32:55')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 15:32:55' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18*2021-11-30*160.00," WHERE transferproductid = 1002;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('216', '1', '18', '1', '1002', 'تحويل منتجات من المخزن', 'storemovementController.php', '18.00', '0', '1', '2021-11-30','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('216', '8', '18', '1', '2021-11-30');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2021-11-30', 8, 216, 0, 0
                    , 160.00, 18, 0, 0, 1, '2021-11-30 15:32:55')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2021-11-30 15:32:55' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('216', '8', '18', '0', '1002', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18', '1', '2021-11-30','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:02:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:32:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 15:32:56', '1', 'sucess', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:03:02";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:33:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2021-11-30 15:33:02', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:03:15";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:33:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:33:15', '1', 'add', '156.201.68.237', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2021-11-30' WHERE storedetailid = '1569';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('216', '8', '18', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '18.00', '18', '1', '2021-11-30','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:03:16";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 15:33:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 15:33:16', '1', 'show', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:49:16";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 16:19:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 16:19:16', '3', '', '156.201.68.237', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:49:16";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 12:49:24";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 16:19:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-30 16:19:24', '3', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 13:38:19";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 17:08:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 17:08:19', '3', 'addsellBill', '156.201.68.237', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 13:52:49";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 17:22:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 17:22:49', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 13:52:50";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 13:52:55";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 17:22:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-30 17:22:55', '1', '', '156.201.68.237', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 13:53:10";
UPDATE user SET loginip = "156.201.68.237", lastactivetime = "2021-11-30 17:23:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-30 17:23:11', '1', 'show', '156.201.68.237', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 15:52:08";
UPDATE user SET loginip = "154.176.135.217", lastactivetime = "2021-11-30 19:22:08", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 19:22:08', '8', '', '154.176.135.217', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 15:52: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 < "2021-11-30 15:52:15";
UPDATE user SET loginip = "154.176.135.217", lastactivetime = "2021-11-30 19:22:15", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 19:22:15', '8', 'addsellBill', '154.176.135.217', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 17:55:00";
UPDATE user SET loginip = "197.56.138.72", lastactivetime = "2021-11-30 21:25:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-30 21:25:01', '1', '', '197.56.138.72', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 17:55:01";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 17:55:04";
UPDATE user SET loginip = "197.56.138.72", lastactivetime = "2021-11-30 21:25:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2021-11-30 21:25:04', '1', '', '197.56.138.72', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 18:05:45";
UPDATE user SET loginip = "197.56.138.72", lastactivetime = "2021-11-30 21:35:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-30 21:35:45', '1', '', '197.56.138.72', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 18:28:49";
UPDATE user SET loginip = "156.164.217.207", lastactivetime = "2021-11-30 21:58:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 21:58:49', '7', 'addsellBill', '156.164.217.207', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-30 18:28:50";
UPDATE user SET loginip = "156.164.217.207", lastactivetime = "2021-11-30 21:58:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-30 21:58:50', '7', 'addsellBill', '156.164.217.207', '', 'DESKTOP');
