UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:14:44";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:15:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:45:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-02 13:45:03', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=3192
UPDATE programsettings SET companyname = 'الشاذلي للاضاءه الحديثه', address = ' العنوان :كفر بهيده بجوار المستشفي<br/> المرتجع خلال 3 اشهورمن تاريخ الفاتوره<br/>الا الاسلاك خلال 20يوم<br/>ممنوع رجوع الاسلاك والليد المفتوح', specializtion = '', phone = '01096879556-01091024885', faxnumber = '', email = 'mousa_maged@hotmail.com', website = '', logo = 'a5583ab9a3a85fbef9bfbbd46031c2d2.jpeg', roundnumbers = '1', saveprinting = '1', deptprinting = '1', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '2',clientsearchvalue = '2', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = 'D', taxcard = '123456789123', commercialregistration = '1234', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2026-10-02',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , 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 = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',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 = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='9aad922c8dc25742295df2779fde48ab62230719d569b9aa71bf6d5e0e08471c7dbda60d508155af60894a0ba3bbd86ffbee699027a409bcd9ca11e28a846cc5',associatedtags='0',commentClientChasis='0',dollarExType='64',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0'
                ,reviewRecords='',reviewRecordsLastDate='0000-00-00',showepayrestaurant='0',showSellAllPriceInStoreDetail='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
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 < "2026-10-02 10:15:10";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-02 13:45:10', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=3193
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:15:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:45:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:45:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3194
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:24:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:54:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:54:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3195
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:24:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:54:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:54:31', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=186'); -- id=3196
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:24:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:54:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:54:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=3197
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:29:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:59:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:59:44', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3198

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abf9b7d7d76a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(42,@clientdebt,@clientname,@treeIdis);
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,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-02 13:59:45', '06abf9b7d7d76a', '42', '36783.00', '32806.3', '0', '1', '3976.7', '3976.7', '0', '-3976.7', '1', '2026-10-02 13:59:45', '', '1', '0', 'طارق فرج الشيخ ','1', '1', '5', '0', 'طارق فرج الشيخ ', '75', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=12
UPDATE client SET  clientdebt = '32806.3', userid = '1' WHERE clientid = '42';
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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('42','36783.00','3976.7','1','اضافة فاتورة مردوات مبيعات','12', '32806.3', '2026-10-02 13:59:45', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '3976.7', '0', null, '0', null, null,'', '0','1','1','3976.7','1','2026-10-02 13:59:45','0','0','',''); -- id=320
UPDATE client SET  inUse = 0 where clientid = 42;
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('303.00', '00033', '12', '8', '33', '4', '375', '1500', '0', '', '1', '0', '33', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','375','1500','0','','0'); -- id=42
UPDATE returnsellbilldetail SET  lastbuyprice = 303.00 , meanbuyprice = 303.00, lastbuyprice_withDiscount = 303.00, meanbuyprice_withDiscount = 303.00
        , lastbuyprice_withTax = 303, meanbuyprice_withTax = 303, lastbuyprice_withDiscountAndTax = 303
                where returnsellbilldetailid = 42;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (33, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1500, 1212, 1212, 1212
                    , 1212, 1212, 1212, 0, 4, 0, 0, 1212, 1212)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1500, returnSellCostBuyPrice = returnSellCostBuyPrice+1212, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1212
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1212, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1212
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1212
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1212
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1212
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1212
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1500, 1212, 1212, 1212
                    , 1212, 1212, 1212, 0, 0, 1212, 1212)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1500, returnSellCostBuyPrice = returnSellCostBuyPrice+1212, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1212
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1212, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1212
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1212
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1212
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1212
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1212;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-02 13:59:46' WHERE storedetailid = '33';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('33', '1', '4', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '11', '15', '1', '2026-10-02 13:59:46','0','0'); -- id=3030
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('52.75', '00001', '12', '1', '1', '2', '56', '112', '0', '', '1', '0', '1', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','56','112','0','','0'); -- id=43
UPDATE returnsellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where returnsellbilldetailid = 43;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 112, 105.5, 105.5, 105.5
                    , 105.5, 105.5, 105.5, 0, 2, 0, 0, 105.5, 105.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+112, returnSellCostBuyPrice = returnSellCostBuyPrice+105.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105.5
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 112, 105.5, 105.5, 105.5
                    , 105.5, 105.5, 105.5, 0, 0, 105.5, 105.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+112, returnSellCostBuyPrice = returnSellCostBuyPrice+105.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105.5;
UPDATE storedetail SET  productquantity = '461', userid = '1', storedetaildate = '2026-10-02 13:59:46' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '2', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '459', '461', '1', '2026-10-02 13:59:46','0','0'); -- id=3031
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('11.75', '00102', '12', '3', '102', '1', '12', '12', '0', '', '1', '0', '102', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','12','12','0','','0'); -- id=44
UPDATE returnsellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where returnsellbilldetailid = 44;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 12, 11.75, 11.75, 11.75
                    , 11.75, 11.75, 11.75, 0, 1, 0, 0, 11.75, 11.75)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+12, returnSellCostBuyPrice = returnSellCostBuyPrice+11.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+11.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+11.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+11.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+11.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+11.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+11.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+11.75
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 12, 11.75, 11.75, 11.75
                    , 11.75, 11.75, 11.75, 0, 0, 11.75, 11.75)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+12, returnSellCostBuyPrice = returnSellCostBuyPrice+11.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+11.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+11.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+11.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+11.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+11.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+11.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+11.75;
UPDATE storedetail SET  productquantity = '1251', userid = '1', storedetaildate = '2026-10-02 13:59:47' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '1', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1250', '1251', '1', '2026-10-02 13:59:47','0','0'); -- id=3032
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('34.80', '00004', '12', '1', '4', '13', '37', '481', '0', '', '1', '0', '4', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','37','481','0','','0'); -- id=45
UPDATE returnsellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where returnsellbilldetailid = 45;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 481, 452.4, 452.4, 452.4
                    , 452.4, 452.4, 452.4, 0, 13, 0, 0, 452.4, 452.4)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+481, returnSellCostBuyPrice = returnSellCostBuyPrice+452.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+452.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+452.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+452.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+452.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+452.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+452.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+452.4
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+13;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 481, 452.4, 452.4, 452.4
                    , 452.4, 452.4, 452.4, 0, 0, 452.4, 452.4)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+481, returnSellCostBuyPrice = returnSellCostBuyPrice+452.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+452.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+452.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+452.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+452.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+452.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+452.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+452.4;
UPDATE storedetail SET  productquantity = '1581', userid = '1', storedetaildate = '2026-10-02 13:59:47' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '13', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1568', '1581', '1', '2026-10-02 13:59:47','0','0'); -- id=3033
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('105.00', '00006', '12', '1', '6', '3', '109', '327', '0', '', '1', '0', '6', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','109','327','0','','0'); -- id=46
UPDATE returnsellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where returnsellbilldetailid = 46;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 327, 315, 315, 315
                    , 315, 315, 315, 0, 3, 0, 0, 315, 315)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+327, returnSellCostBuyPrice = returnSellCostBuyPrice+315, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+315
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+315, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+315
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+315
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+315
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+315
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+315
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 327, 315, 315, 315
                    , 315, 315, 315, 0, 0, 315, 315)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+327, returnSellCostBuyPrice = returnSellCostBuyPrice+315, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+315
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+315, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+315
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+315
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+315
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+315
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+315;
UPDATE storedetail SET  productquantity = '167', userid = '1', storedetaildate = '2026-10-02 13:59:47' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '3', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '164', '167', '1', '2026-10-02 13:59:47','0','0'); -- id=3034
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('105.00', '00011', '12', '1', '11', '1', '109', '109', '0', '', '1', '0', '11', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','109','109','0','','0'); -- id=47
UPDATE returnsellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where returnsellbilldetailid = 47;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 109, 105, 105, 105
                    , 105, 105, 105, 0, 1, 0, 0, 105, 105)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+109, returnSellCostBuyPrice = returnSellCostBuyPrice+105, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 109, 105, 105, 105
                    , 105, 105, 105, 0, 0, 105, 105)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+109, returnSellCostBuyPrice = returnSellCostBuyPrice+105, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105;
UPDATE storedetail SET  productquantity = '122', userid = '1', storedetaildate = '2026-10-02 13:59:48' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '1', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '121', '122', '1', '2026-10-02 13:59:48','0','0'); -- id=3035
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('63.00', '00012', '12', '1', '12', '4', '66', '264', '0', '', '1', '0', '12', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','66','264','0','','0'); -- id=48
UPDATE returnsellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where returnsellbilldetailid = 48;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 264, 252, 252, 252
                    , 252, 252, 252, 0, 4, 0, 0, 252, 252)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+264, returnSellCostBuyPrice = returnSellCostBuyPrice+252, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+252
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+252, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+252
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+252
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+252
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+252
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+252
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 264, 252, 252, 252
                    , 252, 252, 252, 0, 0, 252, 252)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+264, returnSellCostBuyPrice = returnSellCostBuyPrice+252, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+252
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+252, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+252
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+252
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+252
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+252
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+252;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-02 13:59:48' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '4', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '49', '53', '1', '2026-10-02 13:59:48','0','0'); -- id=3036
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('121.40', '00040', '12', '1', '40', '3', '128', '384', '0', '', '1', '0', '40', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','128','384','0','','0'); -- id=49
UPDATE returnsellbilldetail SET  lastbuyprice = 121.40 , meanbuyprice = 121.40, lastbuyprice_withDiscount = 121.40, meanbuyprice_withDiscount = 121.40
        , lastbuyprice_withTax = 121.4, meanbuyprice_withTax = 121.4, lastbuyprice_withDiscountAndTax = 121.4
                where returnsellbilldetailid = 49;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 384, 364.2, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 0, 3, 0, 0, 364.2, 364.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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+384, returnSellCostBuyPrice = returnSellCostBuyPrice+364.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+364.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+364.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+364.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+364.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+364.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+364.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+364.2
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 384, 364.2, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 0, 0, 364.2, 364.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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+384, returnSellCostBuyPrice = returnSellCostBuyPrice+364.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+364.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+364.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+364.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+364.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+364.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+364.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+364.2;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-02 13:59:48' WHERE storedetailid = '40';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('40', '1', '3', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '57', '60', '1', '2026-10-02 13:59:48','0','0'); -- id=3037
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('34.80', '00003', '12', '1', '3', '4', '37', '148', '0', '', '1', '0', '3', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','37','148','0','','0'); -- id=50
UPDATE returnsellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where returnsellbilldetailid = 50;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 148, 139.2, 139.2, 139.2
                    , 139.2, 139.2, 139.2, 0, 4, 0, 0, 139.2, 139.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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+148, returnSellCostBuyPrice = returnSellCostBuyPrice+139.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+139.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+139.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+139.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+139.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+139.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+139.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+139.2
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 148, 139.2, 139.2, 139.2
                    , 139.2, 139.2, 139.2, 0, 0, 139.2, 139.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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+148, returnSellCostBuyPrice = returnSellCostBuyPrice+139.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+139.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+139.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+139.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+139.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+139.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+139.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+139.2;
UPDATE storedetail SET  productquantity = '1327', userid = '1', storedetaildate = '2026-10-02 13:59:49' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '4', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1323', '1327', '1', '2026-10-02 13:59:49','0','0'); -- id=3038
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('163.00', '00015', '12', '1', '15', '1', '170', '170', '0', '', '1', '0', '15', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','170','170','0','','0'); -- id=51
UPDATE returnsellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where returnsellbilldetailid = 51;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 163, 163, 163
                    , 163, 163, 163, 0, 1, 0, 0, 163, 163)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+163, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+163
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+163, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+163
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+163
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+163
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+163
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+163
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 163, 163, 163
                    , 163, 163, 163, 0, 0, 163, 163)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+163, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+163
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+163, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+163
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+163
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+163
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+163
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+163;
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2026-10-02 13:59:49' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '1', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '101', '102', '1', '2026-10-02 13:59:49','0','0'); -- id=3039
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('4.50', '00103', '12', '3', '103', '2', '5.5', '11', '0', '', '1', '0', '103', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','5.5','11','0','','0'); -- id=52
UPDATE returnsellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where returnsellbilldetailid = 52;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 11, 9, 9, 9
                    , 9, 9, 9, 0, 2, 0, 0, 9, 9)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+11, returnSellCostBuyPrice = returnSellCostBuyPrice+9, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+9
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+9, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+9
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+9
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+9
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+9
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+9
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 11, 9, 9, 9
                    , 9, 9, 9, 0, 0, 9, 9)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+11, returnSellCostBuyPrice = returnSellCostBuyPrice+9, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+9
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+9, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+9
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+9
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+9
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+9
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+9;
UPDATE storedetail SET  productquantity = '1908', userid = '1', storedetaildate = '2026-10-02 13:59:49' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '2', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1906', '1908', '1', '2026-10-02 13:59:49','0','0'); -- id=3040
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('61.50', '00434', '12', '3', '434', '1', '64.5', '64.5', '0', '', '1', '0', '434', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','64.5','64.5','0','','0'); -- id=53
UPDATE returnsellbilldetail SET  lastbuyprice = 61.50 , meanbuyprice = 61.50, lastbuyprice_withDiscount = 61.50, meanbuyprice_withDiscount = 61.50
        , lastbuyprice_withTax = 61.5, meanbuyprice_withTax = 61.5, lastbuyprice_withDiscountAndTax = 61.5
                where returnsellbilldetailid = 53;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (434, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 64.5, 61.5, 61.5, 61.5
                    , 61.5, 61.5, 61.5, 0, 1, 0, 0, 61.5, 61.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+64.5, returnSellCostBuyPrice = returnSellCostBuyPrice+61.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+61.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+61.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+61.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+61.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+61.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+61.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+61.5
                        , 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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 64.5, 61.5, 61.5, 61.5
                    , 61.5, 61.5, 61.5, 0, 0, 61.5, 61.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+64.5, returnSellCostBuyPrice = returnSellCostBuyPrice+61.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+61.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+61.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+61.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+61.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+61.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+61.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+61.5;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-02 13:59:50' WHERE storedetailid = '434';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('434', '1', '1', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '28', '29', '1', '2026-10-02 13:59:50','0','0'); -- id=3041
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,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('10.55', '00005', '12', '1', '5', '36', '10.95', '394.2', '0', '', '1', '0', '5', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','10.95','394.2','0','','0'); -- id=54
UPDATE returnsellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where returnsellbilldetailid = 54;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 394.2, 379.8, 379.8, 379.8
                    , 379.8, 379.8, 379.8, 0, 36, 0, 0, 379.8, 379.8)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+394.2, returnSellCostBuyPrice = returnSellCostBuyPrice+379.8, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+379.8
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+379.8, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+379.8
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+379.8
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+379.8
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+379.8
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+379.8
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+36;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 394.2, 379.8, 379.8, 379.8
                    , 379.8, 379.8, 379.8, 0, 0, 379.8, 379.8)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+394.2, returnSellCostBuyPrice = returnSellCostBuyPrice+379.8, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+379.8
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+379.8, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+379.8
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+379.8
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+379.8
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+379.8
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+379.8;
UPDATE storedetail SET  productquantity = '1235', userid = '1', storedetaildate = '2026-10-02 13:59:50' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '36', '0', '12', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1199', '1235', '1', '2026-10-02 13:59:50','0','0'); -- id=3042
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3976.7', '3976.7', '2026-10-02', '1', '0', '0', '2026-10-02 13:59:50','اضافة فاتورة مردود مبيعات رقم 12','1','0',null,'0','12','returnsellbillController.php?do=showDetail&returnsellbillid=12'); -- id=1196
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1196', '143', '3976.7', '','0'); -- id=1198
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '721076.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1196', '474', '3976.7', '','0'); -- id=1197
UPDATE accountstree SET name = 'طارق فرج الشيخ ', customName = 'طارق فرج الشيخ ', customNameEn = 'طارق فرج الشيخ ', nameEn = 'طارق فرج الشيخ ', parent = '58', accountNature = '0', theValue = '32806.3', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 10:01:32' WHERE id = '474';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3570.35', '3570.35', '2026-10-02', '1', '0', '0', '2026-10-02 13:59:50','اضافة فاتورة مردود مبيعات رقم 12 - صرف البضاعة من المخزن','1','0',null,'0','12','returnsellbillController.php?do=showDetail&returnsellbillid=12'); -- id=1197
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1197', '382', '3570.35', '','0'); -- id=1199
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2629567.12', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1197', '402', '3570.35', '','0'); -- id=1198
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '658006.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='1196,0,1197' where returnsellbillid=12;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 3976.7, 3570.35, 3570.35, 3570.35
                    , 3570.35, 3570.35, 3570.35 ,0, 0, 3570.35, 3570.35)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+3976.7, returnSellCostBuyPrice = returnSellCostBuyPrice+3570.35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3570.35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3570.35, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3570.35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3570.35
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3570.35
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3570.35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3570.35;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-02', 0, 0, 0
                    , 0, 0, 0, 0
                    , 3976.7, 3570.35, 3570.35, 3570.35
                    , 3570.35, 3570.35, 3570.35 ,0, 0, 3570.35, 3570.35)
                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
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+3976.7, returnSellCostBuyPrice = returnSellCostBuyPrice+3570.35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3570.35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3570.35, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3570.35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3570.35
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3570.35
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3570.35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3570.35;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -3976.7, -3570.35, -3570.35
                    , -3570.35, -3570.35, -3570.35, -3570.35, -3570.35, -3570.35)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-3976.7, netSellCostBuyPrice = netSellCostBuyPrice+-3570.35
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-3570.35
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-3570.35
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-3570.35
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-3570.35
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-3570.35
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-3570.35
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-3570.35;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abf9b7d7d76a and sellbillId = 12 and returnsellbillId = 12
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:29:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 13:59:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 13:59:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=3199
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:30:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:00:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:00:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3200
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:30:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:00:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-02 14:00:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3201
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:30:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:00:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-02 14:00:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3202
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:30:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:00:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:00:39', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=186'); -- id=3203
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:31:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:01:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:01:26', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3204
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:31:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:01:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:01:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3205
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:31:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:01:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:01:44', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=186'); -- id=3206
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:32:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:02:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:02:08', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3207
BEGIN;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - with id = 186 and  = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete start with id = 186 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 186;
UPDATE sellbill SET  sellbillsysdate = '2026-10-02 14:02:09', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '186';
UPDATE sellbilldetail SET  lastbuyprice = 16.10 , meanbuyprice = 16.10, lastbuyprice_withDiscount = 16.10, meanbuyprice_withDiscount = 16.10
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where sellbilldetailid = 1507;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (138, '2026-10-02', 651.3, 627.9, 627.9
                    , 627.9, 627.9, 627.9, 627.9
                    , 0, 0, 0, 0
                    , 0, 0, 0,39,0, 627.9, 627.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-651.3, sellCostBuyPrice =sellCostBuyPrice-627.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-627.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-627.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-627.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-627.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-627.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-627.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-627.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-39
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 651.3, 627.9, 627.9
                    , 627.9, 627.9, 627.9, 627.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 627.9, 627.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-651.3, sellCostBuyPrice =sellCostBuyPrice-627.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-627.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-627.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-627.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-627.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-627.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-627.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-627.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '425', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '138';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('138', '1', '39', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '386', '425', '1', '2026-09-29 10:10:56','0','0'); -- id=3043
UPDATE sellbilldetail SET  lastbuyprice = 39.90 , meanbuyprice = 39.90, lastbuyprice_withDiscount = 39.90, meanbuyprice_withDiscount = 39.90
        , lastbuyprice_withTax = 39.9, meanbuyprice_withTax = 39.9, lastbuyprice_withDiscountAndTax = 39.9
                where sellbilldetailid = 1508;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (135, '2026-10-02', 900, 798, 798
                    , 798, 798, 798, 798
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 798, 798, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-900, sellCostBuyPrice =sellCostBuyPrice-798
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-798, sellCostMeanBuyPrice = sellCostMeanBuyPrice-798
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-798, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-798
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-798
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-798
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-798
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 900, 798, 798
                    , 798, 798, 798, 798
                    , 0, 0, 0, 0
                    , 0, 0, 0, 798, 798, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-900, sellCostBuyPrice =sellCostBuyPrice-798
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-798, sellCostMeanBuyPrice = sellCostMeanBuyPrice-798
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-798, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-798
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-798
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-798
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-798
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '135';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('135', '1', '20', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '44', '1', '2026-09-29 10:10:56','0','0'); -- id=3044
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1509;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-02', 1554, 1461.6, 1461.6
                    , 1461.6, 1461.6, 1461.6, 1461.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,42,0, 1461.6, 1461.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1554, sellCostBuyPrice =sellCostBuyPrice-1461.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1461.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1461.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1461.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1461.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1461.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1461.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1461.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-42
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1554, 1461.6, 1461.6
                    , 1461.6, 1461.6, 1461.6, 1461.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1461.6, 1461.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1554, sellCostBuyPrice =sellCostBuyPrice-1461.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1461.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1461.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1461.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1461.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1461.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1461.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1461.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1623', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '42', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1581', '1623', '1', '2026-09-29 10:10:56','0','0'); -- id=3045
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1510;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-02', 1480, 1392, 1392
                    , 1392, 1392, 1392, 1392
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 1392, 1392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1480, sellCostBuyPrice =sellCostBuyPrice-1392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1392, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1392
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1480, 1392, 1392
                    , 1392, 1392, 1392, 1392
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1392, 1392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1480, sellCostBuyPrice =sellCostBuyPrice-1392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1392, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1392
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1367', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '40', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1327', '1367', '1', '2026-09-29 10:10:56','0','0'); -- id=3046
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 62;
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1511;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-10-02', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-545, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-545, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '172', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '5', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '167', '172', '1', '2026-09-29 10:10:56','0','0'); -- id=3047
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 1512;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (532, '2026-10-02', 270, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-270, sellCostBuyPrice =sellCostBuyPrice-225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-225, sellCostMeanBuyPrice = sellCostMeanBuyPrice-225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-225
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 270, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-270, sellCostBuyPrice =sellCostBuyPrice-225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-225, sellCostMeanBuyPrice = sellCostMeanBuyPrice-225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-225
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '532';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('532', '1', '3', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '3', '1', '2026-09-29 10:10:56','0','0'); -- id=3048
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 109;
UPDATE sellbilldetail SET  lastbuyprice = 217.92 , meanbuyprice = 215.92, lastbuyprice_withDiscount = 217.92, meanbuyprice_withDiscount = 215.92
        , lastbuyprice_withTax = 217.92, meanbuyprice_withTax = 215.92, lastbuyprice_withDiscountAndTax = 217.92
                where sellbilldetailid = 1513;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (196, '2026-10-02', 490, 435.84, 435.84
                    , 431.84, 435.84, 431.84, 435.84
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 435.84, 431.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-490, sellCostBuyPrice =sellCostBuyPrice-435.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice-431.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-431.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-435.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-431.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 490, 435.84, 435.84
                    , 431.84, 435.84, 431.84, 435.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435.84, 431.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-490, sellCostBuyPrice =sellCostBuyPrice-435.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice-431.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-431.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-435.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-431.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '214', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '212', '214', '1', '2026-09-29 10:10:56','0','0'); -- id=3049
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1514;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-10-02', 396, 378, 378
                    , 378, 378, 378, 378
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 378, 378, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-396, sellCostBuyPrice =sellCostBuyPrice-378
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-378, sellCostMeanBuyPrice = sellCostMeanBuyPrice-378
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-378, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-378
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-378
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-378
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-378
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 396, 378, 378
                    , 378, 378, 378, 378
                    , 0, 0, 0, 0
                    , 0, 0, 0, 378, 378, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-396, sellCostBuyPrice =sellCostBuyPrice-378
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-378, sellCostMeanBuyPrice = sellCostMeanBuyPrice-378
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-378, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-378
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-378
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-378
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-378
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '59', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '6', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '53', '59', '1', '2026-09-29 10:10:56','0','0'); -- id=3050
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 56;
UPDATE sellbilldetail SET  lastbuyprice = 121.40 , meanbuyprice = 121.40, lastbuyprice_withDiscount = 121.40, meanbuyprice_withDiscount = 121.40
        , lastbuyprice_withTax = 121.4, meanbuyprice_withTax = 121.4, lastbuyprice_withDiscountAndTax = 121.4
                where sellbilldetailid = 1515;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-10-02', 384, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 364.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 364.2, 364.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-384, sellCostBuyPrice =sellCostBuyPrice-364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-364.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-364.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-364.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-364.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 384, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 364.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 364.2, 364.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-384, sellCostBuyPrice =sellCostBuyPrice-364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-364.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-364.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-364.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-364.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '63', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '40';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('40', '1', '3', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '60', '63', '1', '2026-09-29 10:10:56','0','0'); -- id=3051
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 69;
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 1516;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-10-02', 1560, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1560, sellCostBuyPrice =sellCostBuyPrice-1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1422
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1560, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1560, sellCostBuyPrice =sellCostBuyPrice-1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1422
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2026-10-02 14:02:09' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '6', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '68', '74', '1', '2026-09-29 10:10:56','0','0'); -- id=3052
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 63;
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1517;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-10-02', 1308, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1308, sellCostBuyPrice =sellCostBuyPrice-1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1260
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1308, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1308, sellCostBuyPrice =sellCostBuyPrice-1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1260
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '134', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '12', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '122', '134', '1', '2026-09-29 10:10:56','0','0'); -- id=3053
UPDATE sellbilldetail SET  lastbuyprice = 100.00 , meanbuyprice = 100.00, lastbuyprice_withDiscount = 100.00, meanbuyprice_withDiscount = 100.00
        , lastbuyprice_withTax = 100, meanbuyprice_withTax = 100, lastbuyprice_withDiscountAndTax = 100
                where sellbilldetailid = 1518;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (8, '2026-10-02', 210, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-210, sellCostBuyPrice =sellCostBuyPrice-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 210, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-210, sellCostBuyPrice =sellCostBuyPrice-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '8';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('8', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '34', '1', '2026-09-29 10:10:56','0','0'); -- id=3054
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 1519;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-10-02', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-317.7, sellCostBuyPrice =sellCostBuyPrice-306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-306, sellCostMeanBuyPrice = sellCostMeanBuyPrice-306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-306
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-317.7, sellCostBuyPrice =sellCostBuyPrice-306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-306, sellCostMeanBuyPrice = sellCostMeanBuyPrice-306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-306
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '13';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('13', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '16', '1', '2026-09-29 10:10:56','0','0'); -- id=3055
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 1520;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 4200, 3956.25, 3956.25
                    , 3956.25, 3956.25, 3956.25, 3956.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,75,0, 3956.25, 3956.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4200, sellCostBuyPrice =sellCostBuyPrice-3956.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3956.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3956.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3956.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3956.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3956.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3956.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3956.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-75
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 4200, 3956.25, 3956.25
                    , 3956.25, 3956.25, 3956.25, 3956.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3956.25, 3956.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4200, sellCostBuyPrice =sellCostBuyPrice-3956.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3956.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3956.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3956.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3956.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3956.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3956.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3956.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '536', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '75', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '461', '536', '1', '2026-09-29 10:10:56','0','0'); -- id=3056
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1521;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-02', 1423.5, 1371.5, 1371.5
                    , 1371.5, 1371.5, 1371.5, 1371.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,130,0, 1371.5, 1371.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1423.5, sellCostBuyPrice =sellCostBuyPrice-1371.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1371.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1371.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1371.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1371.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1371.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1371.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1371.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-130
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1423.5, 1371.5, 1371.5
                    , 1371.5, 1371.5, 1371.5, 1371.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1371.5, 1371.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1423.5, sellCostBuyPrice =sellCostBuyPrice-1371.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1371.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1371.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1371.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1371.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1371.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1371.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1371.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1365', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '130', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1235', '1365', '1', '2026-09-29 10:10:56','0','0'); -- id=3057
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 1522;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-02', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-95, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-95, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '225', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '220', '225', '1', '2026-09-29 10:10:56','0','0'); -- id=3058
UPDATE sellbilldetail SET  lastbuyprice = 41.28 , meanbuyprice = 41.28, lastbuyprice_withDiscount = 41.28, meanbuyprice_withDiscount = 41.28
        , lastbuyprice_withTax = 41.28, meanbuyprice_withTax = 41.28, lastbuyprice_withDiscountAndTax = 41.28
                where sellbilldetailid = 1523;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (187, '2026-10-02', 3840, 3302.4, 3302.4
                    , 3302.4, 3302.4, 3302.4, 3302.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,80,0, 3302.4, 3302.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3302.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3302.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3302.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3302.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3302.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3302.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3302.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3302.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-80
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 3840, 3302.4, 3302.4
                    , 3302.4, 3302.4, 3302.4, 3302.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3302.4, 3302.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3302.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3302.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3302.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3302.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3302.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3302.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3302.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3302.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '306', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '80', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '226', '306', '1', '2026-09-29 10:10:56','0','0'); -- id=3059
UPDATE sellbilldetail SET  lastbuyprice = 118.30 , meanbuyprice = 118.30, lastbuyprice_withDiscount = 118.30, meanbuyprice_withDiscount = 118.30
        , lastbuyprice_withTax = 118.3, meanbuyprice_withTax = 118.3, lastbuyprice_withDiscountAndTax = 118.3
                where sellbilldetailid = 1524;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (198, '2026-10-02', 675, 591.5, 591.5
                    , 591.5, 591.5, 591.5, 591.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 591.5, 591.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-675, sellCostBuyPrice =sellCostBuyPrice-591.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-591.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-591.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-591.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-591.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-591.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-591.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-591.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 675, 591.5, 591.5
                    , 591.5, 591.5, 591.5, 591.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 591.5, 591.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-675, sellCostBuyPrice =sellCostBuyPrice-591.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-591.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-591.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-591.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-591.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-591.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-591.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-591.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '198';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('198', '1', '5', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '52', '57', '1', '2026-09-29 10:10:56','0','0'); -- id=3060
UPDATE sellbilldetail SET  lastbuyprice = 188.30 , meanbuyprice = 188.30, lastbuyprice_withDiscount = 188.30, meanbuyprice_withDiscount = 188.30
        , lastbuyprice_withTax = 188.3, meanbuyprice_withTax = 188.3, lastbuyprice_withDiscountAndTax = 188.3
                where sellbilldetailid = 1525;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (199, '2026-10-02', 400, 376.6, 376.6
                    , 376.6, 376.6, 376.6, 376.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 376.6, 376.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-400, sellCostBuyPrice =sellCostBuyPrice-376.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-376.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-376.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-376.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-376.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-376.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-376.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-376.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 400, 376.6, 376.6
                    , 376.6, 376.6, 376.6, 376.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 376.6, 376.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-400, sellCostBuyPrice =sellCostBuyPrice-376.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-376.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-376.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-376.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-376.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-376.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-376.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-376.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '27', '1', '2026-09-29 10:10:56','0','0'); -- id=3061
UPDATE sellbilldetail SET  lastbuyprice = 76.50 , meanbuyprice = 76.50, lastbuyprice_withDiscount = 76.50, meanbuyprice_withDiscount = 76.50
        , lastbuyprice_withTax = 76.5, meanbuyprice_withTax = 76.5, lastbuyprice_withDiscountAndTax = 76.5
                where sellbilldetailid = 1526;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (320, '2026-10-02', 170, 153, 153
                    , 153, 153, 153, 153
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 153, 153, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-153
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-153, sellCostMeanBuyPrice = sellCostMeanBuyPrice-153
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-153, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-153
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-153
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-153
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-153
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 170, 153, 153
                    , 153, 153, 153, 153
                    , 0, 0, 0, 0
                    , 0, 0, 0, 153, 153, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-153
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-153, sellCostMeanBuyPrice = sellCostMeanBuyPrice-153
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-153, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-153
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-153
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-153
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-153
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-10-02 14:02:10' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '18', '1', '2026-09-29 10:10:56','0','0'); -- id=3062
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
        , lastbuyprice_withTax = 255, meanbuyprice_withTax = 255, lastbuyprice_withDiscountAndTax = 255
                where sellbilldetailid = 1527;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (35, '2026-10-02', 2360, 2040, 2040
                    , 2040, 2040, 2040, 2040
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2360, sellCostBuyPrice =sellCostBuyPrice-2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2040
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 2360, 2040, 2040
                    , 2040, 2040, 2040, 2040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2360, sellCostBuyPrice =sellCostBuyPrice-2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2040
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '35';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('35', '1', '8', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '28', '1', '2026-09-29 10:10:56','0','0'); -- id=3063
UPDATE sellbilldetail SET  lastbuyprice = 329.00 , meanbuyprice = 329.00, lastbuyprice_withDiscount = 329.00, meanbuyprice_withDiscount = 329.00
        , lastbuyprice_withTax = 329, meanbuyprice_withTax = 329, lastbuyprice_withDiscountAndTax = 329
                where sellbilldetailid = 1528;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (31, '2026-10-02', 1640, 1316, 1316
                    , 1316, 1316, 1316, 1316
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1316, 1316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1316, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1316
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1640, 1316, 1316
                    , 1316, 1316, 1316, 1316
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1316, 1316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1316, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1316
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '31';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('31', '1', '4', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '19', '1', '2026-09-29 10:10:56','0','0'); -- id=3064
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
        , lastbuyprice_withTax = 150, meanbuyprice_withTax = 150, lastbuyprice_withDiscountAndTax = 150
                where sellbilldetailid = 1529;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (30, '2026-10-02', 880, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-880, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 880, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-880, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '30';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('30', '1', '4', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '4', '1', '2026-09-29 10:10:56','0','0'); -- id=3065
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 1530;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (428, '2026-10-02', 1580, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1580, sellCostBuyPrice =sellCostBuyPrice-1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1580, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1580, sellCostBuyPrice =sellCostBuyPrice-1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '4', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '46', '50', '1', '2026-09-29 10:10:56','0','0'); -- id=3066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 32;
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 1531;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-02', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-970, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-970, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '29', '31', '1', '2026-09-29 10:10:56','0','0'); -- id=3067
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1532;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (513, '2026-10-02', 315, 275, 275
                    , 275, 275, 275, 275
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 275, 275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-315, sellCostBuyPrice =sellCostBuyPrice-275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-275, sellCostMeanBuyPrice = sellCostMeanBuyPrice-275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-275
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 315, 275, 275
                    , 275, 275, 275, 275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 275, 275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-315, sellCostBuyPrice =sellCostBuyPrice-275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-275, sellCostMeanBuyPrice = sellCostMeanBuyPrice-275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-275
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '22', '23', '1', '2026-09-29 10:10:56','0','0'); -- id=3068
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 31;
UPDATE sellbilldetail SET  lastbuyprice = 1400.00 , meanbuyprice = 1400.00, lastbuyprice_withDiscount = 1400.00, meanbuyprice_withDiscount = 1400.00
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where sellbilldetailid = 1533;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (380, '2026-10-02', 1650, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1650, sellCostBuyPrice =sellCostBuyPrice-1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1650, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1650, sellCostBuyPrice =sellCostBuyPrice-1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('380', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '8', '9', '1', '2026-09-29 10:10:56','0','0'); -- id=3069
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 1534;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (493, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '493';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('493', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-09-29 10:10:56','0','0'); -- id=3070
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 1535;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (547, '2026-10-02', 175, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-175, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 175, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-175, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '547';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('547', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-29 10:10:56','0','0'); -- id=3071
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 57;
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 1536;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-10-02', 510, 489, 489
                    , 489, 489, 489, 489
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 489, 489, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-510, sellCostBuyPrice =sellCostBuyPrice-489
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-489, sellCostMeanBuyPrice = sellCostMeanBuyPrice-489
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-489, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-489
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-489
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-489
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-489
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 510, 489, 489
                    , 489, 489, 489, 489
                    , 0, 0, 0, 0
                    , 0, 0, 0, 489, 489, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-510, sellCostBuyPrice =sellCostBuyPrice-489
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-489, sellCostMeanBuyPrice = sellCostMeanBuyPrice-489
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-489, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-489
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-489
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-489
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-489
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '105', userid = '1', storedetaildate = '2026-10-02 14:02:11' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '3', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '102', '105', '1', '2026-09-29 10:10:56','0','0'); -- id=3072
UPDATE sellbilldetail SET  lastbuyprice = 21.00 , meanbuyprice = 21.00, lastbuyprice_withDiscount = 21.00, meanbuyprice_withDiscount = 21.00
        , lastbuyprice_withTax = 21, meanbuyprice_withTax = 21, lastbuyprice_withDiscountAndTax = 21
                where sellbilldetailid = 1537;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (417, '2026-10-02', 117.5, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-117.5, sellCostBuyPrice =sellCostBuyPrice-105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-105, sellCostMeanBuyPrice = sellCostMeanBuyPrice-105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-105
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 117.5, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-117.5, sellCostBuyPrice =sellCostBuyPrice-105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-105, sellCostMeanBuyPrice = sellCostMeanBuyPrice-105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-105
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '5', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '25', '1', '2026-09-29 10:10:56','0','0'); -- id=3073
UPDATE sellbilldetail SET  lastbuyprice = 221.00 , meanbuyprice = 221.00, lastbuyprice_withDiscount = 221.00, meanbuyprice_withDiscount = 221.00
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where sellbilldetailid = 1538;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-10-02', 230, 221, 221
                    , 221, 221, 221, 221
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 221, 221, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-230, sellCostBuyPrice =sellCostBuyPrice-221
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-221, sellCostMeanBuyPrice = sellCostMeanBuyPrice-221
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-221, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-221
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-221
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-221
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-221
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 230, 221, 221
                    , 221, 221, 221, 221
                    , 0, 0, 0, 0
                    , 0, 0, 0, 221, 221, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-230, sellCostBuyPrice =sellCostBuyPrice-221
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-221, sellCostMeanBuyPrice = sellCostMeanBuyPrice-221
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-221, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-221
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-221
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-221
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-221
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9', '10', '1', '2026-09-29 10:10:56','0','0'); -- id=3074
UPDATE sellbilldetail SET  lastbuyprice = 303.00 , meanbuyprice = 303.00, lastbuyprice_withDiscount = 303.00, meanbuyprice_withDiscount = 303.00
        , lastbuyprice_withTax = 303, meanbuyprice_withTax = 303, lastbuyprice_withDiscountAndTax = 303
                where sellbilldetailid = 1539;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (33, '2026-10-02', 1500, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1500, sellCostBuyPrice =sellCostBuyPrice-1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1212
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1500, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1500, sellCostBuyPrice =sellCostBuyPrice-1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1212
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '33';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('33', '1', '4', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '19', '1', '2026-09-29 10:10:56','0','0'); -- id=3075
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 73;
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 1540;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-02', 300, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-240, sellCostMeanBuyPrice = sellCostMeanBuyPrice-240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-240
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 300, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-240, sellCostMeanBuyPrice = sellCostMeanBuyPrice-240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-240
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '105', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '103', '105', '1', '2026-09-29 10:10:56','0','0'); -- id=3076
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 71;
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 1541;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-02', 319, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-319, sellCostBuyPrice =sellCostBuyPrice-306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-306, sellCostMeanBuyPrice = sellCostMeanBuyPrice-306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-306
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 319, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-319, sellCostBuyPrice =sellCostBuyPrice-306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-306, sellCostMeanBuyPrice = sellCostMeanBuyPrice-306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-306
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '53', '54', '1', '2026-09-29 10:10:56','0','0'); -- id=3077
UPDATE sellbilldetail SET  lastbuyprice = 37.00 , meanbuyprice = 37.00, lastbuyprice_withDiscount = 37.00, meanbuyprice_withDiscount = 37.00
        , lastbuyprice_withTax = 37, meanbuyprice_withTax = 37, lastbuyprice_withDiscountAndTax = 37
                where sellbilldetailid = 1542;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (117, '2026-10-02', 78, 74, 74
                    , 74, 74, 74, 74
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 74, 74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-74, sellCostMeanBuyPrice = sellCostMeanBuyPrice-74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-74
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 78, 74, 74
                    , 74, 74, 74, 74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 74, 74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-74, sellCostMeanBuyPrice = sellCostMeanBuyPrice-74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-74
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '27', '1', '2026-09-29 10:10:56','0','0'); -- id=3078
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 85;
UPDATE sellbilldetail SET  lastbuyprice = 61.50 , meanbuyprice = 61.50, lastbuyprice_withDiscount = 61.50, meanbuyprice_withDiscount = 61.50
        , lastbuyprice_withTax = 61.5, meanbuyprice_withTax = 61.5, lastbuyprice_withDiscountAndTax = 61.5
                where sellbilldetailid = 1543;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (434, '2026-10-02', 193.5, 184.5, 184.5
                    , 184.5, 184.5, 184.5, 184.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 184.5, 184.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-193.5, sellCostBuyPrice =sellCostBuyPrice-184.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 193.5, 184.5, 184.5
                    , 184.5, 184.5, 184.5, 184.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.5, 184.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-193.5, sellCostBuyPrice =sellCostBuyPrice-184.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '434';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('434', '1', '3', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '29', '32', '1', '2026-09-29 10:10:56','0','0'); -- id=3079
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 1544;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-10-02', 105, 91, 91
                    , 91, 91, 91, 91
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 91, 91, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-105, sellCostBuyPrice =sellCostBuyPrice-91
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-91, sellCostMeanBuyPrice = sellCostMeanBuyPrice-91
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-91, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-91
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-91
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-91
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 105, 91, 91
                    , 91, 91, 91, 91
                    , 0, 0, 0, 0
                    , 0, 0, 0, 91, 91, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-105, sellCostBuyPrice =sellCostBuyPrice-91
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-91, sellCostMeanBuyPrice = sellCostMeanBuyPrice-91
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-91, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-91
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-91
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-91
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '243', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '7', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '236', '243', '1', '2026-09-29 10:10:56','0','0'); -- id=3080
UPDATE sellbilldetail SET  lastbuyprice = 22.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 22.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 22
                where sellbilldetailid = 1545;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (275, '2026-10-02', 340, 280, 440
                    , 360, 440, 360, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 340, 280, 440
                    , 360, 440, 360, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '275';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '1', '20', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '10', '30', '1', '2026-09-29 10:10:56','0','0'); -- id=3081
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-7 where id = 11;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 1546;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-02', 84, 82.25, 82.25
                    , 82.25, 82.25, 82.25, 82.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 82.25, 82.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-84, sellCostBuyPrice =sellCostBuyPrice-82.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-82.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-82.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-82.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-82.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-82.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-82.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-82.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 84, 82.25, 82.25
                    , 82.25, 82.25, 82.25, 82.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 82.25, 82.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-84, sellCostBuyPrice =sellCostBuyPrice-82.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-82.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-82.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-82.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-82.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-82.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-82.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-82.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1258', userid = '1', storedetaildate = '2026-10-02 14:02:12' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '7', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1251', '1258', '1', '2026-09-29 10:10:56','0','0'); -- id=3082
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 1547;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-02', 66, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-66, sellCostBuyPrice =sellCostBuyPrice-54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 66, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-66, sellCostBuyPrice =sellCostBuyPrice-54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1920', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '12', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1908', '1920', '1', '2026-09-29 10:10:56','0','0'); -- id=3083
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where sellbilldetailid = 1548;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (267, '2026-10-02', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-420, sellCostBuyPrice =sellCostBuyPrice-385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-385, sellCostMeanBuyPrice = sellCostMeanBuyPrice-385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-385
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-420, sellCostBuyPrice =sellCostBuyPrice-385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-385, sellCostMeanBuyPrice = sellCostMeanBuyPrice-385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-385
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '267';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '4', '1', '2026-09-29 10:10:56','0','0'); -- id=3084
UPDATE sellbilldetail SET  lastbuyprice = 107.52 , meanbuyprice = 107.52, lastbuyprice_withDiscount = 107.52, meanbuyprice_withDiscount = 107.52
        , lastbuyprice_withTax = 107.52, meanbuyprice_withTax = 107.52, lastbuyprice_withDiscountAndTax = 107.52
                where sellbilldetailid = 1549;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (184, '2026-10-02', 115, 107.52, 107.52
                    , 107.52, 107.52, 107.52, 107.52
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 107.52, 107.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-115, sellCostBuyPrice =sellCostBuyPrice-107.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-107.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-107.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-107.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-107.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-107.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-107.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-107.52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 115, 107.52, 107.52
                    , 107.52, 107.52, 107.52, 107.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 107.52, 107.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-115, sellCostBuyPrice =sellCostBuyPrice-107.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-107.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-107.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-107.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-107.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-107.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-107.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-107.52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '207', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '184';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('184', '1', '1', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '206', '207', '1', '2026-09-29 10:10:56','0','0'); -- id=3085
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 1550;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-02', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-96, sellCostBuyPrice =sellCostBuyPrice-85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice-85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-85.44
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-96, sellCostBuyPrice =sellCostBuyPrice-85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice-85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-85.44
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '2', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '855', '857', '1', '2026-09-29 10:10:56','0','0'); -- id=3086
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 96;
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 1551;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-02', 71, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 70.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 70.4, 70.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-71, sellCostBuyPrice =sellCostBuyPrice-70.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 71, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 70.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70.4, 70.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-71, sellCostBuyPrice =sellCostBuyPrice-70.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '600', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '4', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '596', '600', '1', '2026-09-29 10:10:56','0','0'); -- id=3087
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 240
                where sellbilldetailid = 1552;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (556, '2026-10-02', 748.5, 720, 720
                    , 720, 720, 720, 720
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-748.5, sellCostBuyPrice =sellCostBuyPrice-720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-720, sellCostMeanBuyPrice = sellCostMeanBuyPrice-720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-720
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 748.5, 720, 720
                    , 720, 720, 720, 720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-748.5, sellCostBuyPrice =sellCostBuyPrice-720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-720, sellCostMeanBuyPrice = sellCostMeanBuyPrice-720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-720
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-02 14:02:13' WHERE storedetailid = '556';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '1', '3', '0', '186', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '30', '1', '2026-09-29 10:10:56','0','0'); -- id=3088
CALL clientInUse(42,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-3976.7', userid = '1' WHERE clientid = '42';
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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('42','32806.30','36783.00','1','تعديل فاتورة مبيعات','186', '-3976.7', '2026-09-29 10:10:56', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '36783', '0', null, '0', null, null,'', '0','1','1','36783','1','2026-09-29 10:10:56','0','0','',''); -- id=321
UPDATE client SET  inUse = 0 where clientid = 42;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,32474.9, 32470.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36783, sellCostBuyPrice =sellCostBuyPrice-32394.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-32554.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-32470.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-32554.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-32470.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-32554.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-32474.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-32470.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-02', 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32474.9, 32470.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36783, sellCostBuyPrice =sellCostBuyPrice-32394.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-32554.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-32470.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-32554.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-32470.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-32554.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-32474.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-32470.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9, 32474.9, 32470.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-36783, netSellCostBuyPrice = netSellCostBuyPrice-32394.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-32554.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-32470.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-32554.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-32470.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-32554.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-32474.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-32470.9;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete end - with id = 186 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 186 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

COMMIT;
BEGIN;
CALL clientInUse(42,@clientdebt,@clientname,@treeIdis);
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,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-29 10:10:56', '06abb623b942ed', '42', '-3976.70', '32806.3', '0', '1', '36783', '36783', '0', '36783', '1', '2026-09-29 10:10:56', '', '1', '0', 'طارق فرج الشيخ ', '1', '1', '3', '0', 'طارق فرج الشيخ ', '584', '186', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-29','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=188
UPDATE client SET  clientdebt = '32806.3', userid = '1' WHERE clientid = '42';
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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('42','-3976.70','36783','0','اضافة فاتورة مبيعات (معدله)','188', '32806.3', '2026-10-02 14:02:14', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '36783', '0', null, '0', null, null,'', '0','1','1','36783','1','2026-09-29 10:10:56','0','0','',''); -- id=322
UPDATE client SET  inUse = 0 where clientid = 42;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16.1','00138', '188', '21', '138', '39.00', '16.7', '651.3', '0', '', '1', '2026-10-02 14:02:14', '138', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','16.7','651.3','0','','0','0.00','0','0','0','0'); -- id=1555
UPDATE sellbilldetail SET  lastbuyprice = 16.10 , meanbuyprice = 16.10, lastbuyprice_withDiscount = 16.10, meanbuyprice_withDiscount = 16.10
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where sellbilldetailid = 1555;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (138, '2026-10-02', 651.3, 627.9, 627.9
                    , 627.9, 627.9, 627.9, 627.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39, 0, 627.9, 627.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.3, sellCostBuyPrice =sellCostBuyPrice+627.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+627.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+627.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+627.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+627.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+627.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+627.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+627.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+39
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 651.3, 627.9, 627.9
                    , 627.9, 627.9, 627.9, 627.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 627.9, 627.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+651.3, sellCostBuyPrice =sellCostBuyPrice+627.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+627.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+627.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+627.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+627.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+627.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+627.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+627.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '386', userid = '1', storedetaildate = '2026-10-02 14:02:15' WHERE storedetailid = '138';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('138', '1', '39', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '425', '386', '1', '2026-10-02 14:02:15','0','0'); -- id=3089
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.9','00135', '188', '21', '135', '20.00', '45', '900', '0', '', '1', '2026-10-02 14:02:15', '135', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','900','0','','0','0.00','0','0','0','0'); -- id=1556
UPDATE sellbilldetail SET  lastbuyprice = 39.90 , meanbuyprice = 39.90, lastbuyprice_withDiscount = 39.90, meanbuyprice_withDiscount = 39.90
        , lastbuyprice_withTax = 39.9, meanbuyprice_withTax = 39.9, lastbuyprice_withDiscountAndTax = 39.9
                where sellbilldetailid = 1556;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (135, '2026-10-02', 900, 798, 798
                    , 798, 798, 798, 798
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 798, 798, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+798
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+798, sellCostMeanBuyPrice = sellCostMeanBuyPrice+798
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+798, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+798
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+798
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+798
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+798
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 900, 798, 798
                    , 798, 798, 798, 798
                    , 0, 0, 0, 0
                    , 0, 0, 0, 798, 798, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+798
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+798, sellCostMeanBuyPrice = sellCostMeanBuyPrice+798
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+798, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+798
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+798
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+798
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+798
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-02 14:02:15' WHERE storedetailid = '135';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('135', '1', '20', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '24', '1', '2026-10-02 14:02:15','0','0'); -- id=3090
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '188', '1', '4', '42.00', '37', '1554', '0', '', '1', '2026-10-02 14:02:15', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','37','1554','0','','0','0.00','0','0','0','0'); -- id=1557
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1557;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-02', 1554, 1461.6, 1461.6
                    , 1461.6, 1461.6, 1461.6, 1461.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42, 0, 1461.6, 1461.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1554, sellCostBuyPrice =sellCostBuyPrice+1461.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1461.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1461.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1461.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1461.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1461.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1461.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1461.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+42
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1554, 1461.6, 1461.6
                    , 1461.6, 1461.6, 1461.6, 1461.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1461.6, 1461.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1554, sellCostBuyPrice =sellCostBuyPrice+1461.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1461.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1461.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1461.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1461.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1461.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1461.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1461.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1581', userid = '1', storedetaildate = '2026-10-02 14:02:15' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '42', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1623', '1581', '1', '2026-10-02 14:02:15','0','0'); -- id=3091
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00003', '188', '1', '3', '40.00', '37', '1480', '0', '', '1', '2026-10-02 14:02:15', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','37','1480','0','','0','0.00','0','0','0','0'); -- id=1558
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1558;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-02', 1480, 1392, 1392
                    , 1392, 1392, 1392, 1392
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 1392, 1392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1480, sellCostBuyPrice =sellCostBuyPrice+1392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1392, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1392
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1480, 1392, 1392
                    , 1392, 1392, 1392, 1392
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1392, 1392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1480, sellCostBuyPrice =sellCostBuyPrice+1392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1392, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1392
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1327', userid = '1', storedetaildate = '2026-10-02 14:02:16' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '40', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1367', '1327', '1', '2026-10-02 14:02:16','0','0'); -- id=3092
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 62;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00006', '188', '1', '6', '5.00', '109', '545', '0', '', '1', '2026-10-02 14:02:16', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','62-5,','1','1','0','0','109','545','0','','0','0.00','0','0','0','0'); -- id=1559
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1559;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-10-02', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '167', userid = '1', storedetaildate = '2026-10-02 14:02:16' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '5', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '172', '167', '1', '2026-10-02 14:02:16','0','0'); -- id=3093
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('75','00532', '188', '6', '532', '3.00', '90', '270', '0', '', '1', '2026-10-02 14:02:16', '532', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90','270','0','','0','0.00','0','0','0','0'); -- id=1560
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 1560;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (532, '2026-10-02', 270, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+225
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 270, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+225
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+225
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+225
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 14:02:16' WHERE storedetailid = '532';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('532', '1', '3', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '0', '1', '2026-10-02 14:02:16','0','0'); -- id=3094
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 109;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('217.92','00196', '188', '20', '196', '2.00', '245', '490', '0', '', '1', '2026-10-02 14:02:16', '196', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','109-2,','1','1','0','0','245','490','0','','0','0.00','0','0','0','0'); -- id=1561
UPDATE sellbilldetail SET  lastbuyprice = 217.92 , meanbuyprice = 215.92, lastbuyprice_withDiscount = 217.92, meanbuyprice_withDiscount = 215.92
        , lastbuyprice_withTax = 217.92, meanbuyprice_withTax = 215.92, lastbuyprice_withDiscountAndTax = 217.92
                where sellbilldetailid = 1561;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (196, '2026-10-02', 490, 435.84, 435.84
                    , 431.84, 435.84, 431.84, 435.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 435.84, 431.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+490, sellCostBuyPrice =sellCostBuyPrice+435.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice+431.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+431.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+435.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+431.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 490, 435.84, 435.84
                    , 431.84, 435.84, 431.84, 435.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435.84, 431.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+490, sellCostBuyPrice =sellCostBuyPrice+435.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice+431.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+431.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+435.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+431.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '212', userid = '1', storedetaildate = '2026-10-02 14:02:17' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '214', '212', '1', '2026-10-02 14:02:17','0','0'); -- id=3095
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00012', '188', '1', '12', '6.00', '66', '396', '0', '', '1', '2026-10-02 14:02:17', '12', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','66','396','0','','0','0.00','0','0','0','0'); -- id=1562
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1562;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-10-02', 396, 378, 378
                    , 378, 378, 378, 378
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 378, 378, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+396, sellCostBuyPrice =sellCostBuyPrice+378
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+378, sellCostMeanBuyPrice = sellCostMeanBuyPrice+378
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+378, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+378
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+378
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+378
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+378
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 396, 378, 378
                    , 378, 378, 378, 378
                    , 0, 0, 0, 0
                    , 0, 0, 0, 378, 378, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+396, sellCostBuyPrice =sellCostBuyPrice+378
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+378, sellCostMeanBuyPrice = sellCostMeanBuyPrice+378
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+378, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+378
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+378
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+378
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+378
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-02 14:02:17' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '6', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '59', '53', '1', '2026-10-02 14:02:17','0','0'); -- id=3096
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 56;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('121.4','00040', '188', '1', '40', '3.00', '128', '384', '0', '', '1', '2026-10-02 14:02:17', '40', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','56-3,','1','1','0','0','128','384','0','','0','0.00','0','0','0','0'); -- id=1563
UPDATE sellbilldetail SET  lastbuyprice = 121.40 , meanbuyprice = 121.40, lastbuyprice_withDiscount = 121.40, meanbuyprice_withDiscount = 121.40
        , lastbuyprice_withTax = 121.4, meanbuyprice_withTax = 121.4, lastbuyprice_withDiscountAndTax = 121.4
                where sellbilldetailid = 1563;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-10-02', 384, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 364.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 364.2, 364.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+364.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+364.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+364.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+364.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 384, 364.2, 364.2
                    , 364.2, 364.2, 364.2, 364.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 364.2, 364.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+384, sellCostBuyPrice =sellCostBuyPrice+364.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+364.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+364.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+364.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+364.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+364.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+364.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+364.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-02 14:02:17' WHERE storedetailid = '40';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('40', '1', '3', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '63', '60', '1', '2026-10-02 14:02:17','0','0'); -- id=3097
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 69;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237','00010', '188', '1', '10', '6.00', '260', '1560', '0', '', '1', '2026-10-02 14:02:17', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','69-6,','1','1','0','0','260','1560','0','','0','0.00','0','0','0','0'); -- id=1564
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 1564;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-10-02', 1560, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1422
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1560, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1422
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '6', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '74', '68', '1', '2026-10-02 14:02:18','0','0'); -- id=3098
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 63;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00011', '188', '1', '11', '12.00', '109', '1308', '0', '', '1', '2026-10-02 14:02:18', '11', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','63-12,','1','1','0','0','109','1308','0','','0','0.00','0','0','0','0'); -- id=1565
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1565;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-10-02', 1308, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1308, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1308, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1308, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '122', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '12', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '134', '122', '1', '2026-10-02 14:02:18','0','0'); -- id=3099
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('100','00008', '188', '1', '8', '2.00', '105', '210', '0', '', '1', '2026-10-02 14:02:18', '8', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','105','210','0','','0','0.00','0','0','0','0'); -- id=1566
UPDATE sellbilldetail SET  lastbuyprice = 100.00 , meanbuyprice = 100.00, lastbuyprice_withDiscount = 100.00, meanbuyprice_withDiscount = 100.00
        , lastbuyprice_withTax = 100, meanbuyprice_withTax = 100, lastbuyprice_withDiscountAndTax = 100
                where sellbilldetailid = 1566;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (8, '2026-10-02', 210, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 210, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '8';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('8', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '34', '32', '1', '2026-10-02 14:02:18','0','0'); -- id=3100
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00013', '188', '1', '13', '1.00', '317.7', '317.7', '0', '', '1', '2026-10-02 14:02:18', '13', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','317.7','317.7','0','','0','0.00','0','0','0','0'); -- id=1567
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 1567;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-10-02', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+317.7, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+317.7, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '13';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('13', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '15', '1', '2026-10-02 14:02:18','0','0'); -- id=3101
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.75','00001', '188', '1', '1', '75.00', '56', '4200', '0', '', '1', '2026-10-02 14:02:18', '1', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','56','4200','0','','0','0.00','0','0','0','0'); -- id=1568
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 1568;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 4200, 3956.25, 3956.25
                    , 3956.25, 3956.25, 3956.25, 3956.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 3956.25, 3956.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3956.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3956.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3956.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3956.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3956.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3956.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3956.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3956.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 4200, 3956.25, 3956.25
                    , 3956.25, 3956.25, 3956.25, 3956.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3956.25, 3956.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3956.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3956.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3956.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3956.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3956.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3956.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3956.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3956.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '461', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '75', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '536', '461', '1', '2026-10-02 14:02:18','0','0'); -- id=3102
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '188', '1', '5', '130.00', '10.95', '1423.5', '0', '', '1', '2026-10-02 14:02:18', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','1423.5','0','','0','0.00','0','0','0','0'); -- id=1569
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1569;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-02', 1423.5, 1371.5, 1371.5
                    , 1371.5, 1371.5, 1371.5, 1371.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 130, 0, 1371.5, 1371.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1423.5, sellCostBuyPrice =sellCostBuyPrice+1371.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1371.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1371.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1371.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1371.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1371.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1371.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1371.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+130
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1423.5, 1371.5, 1371.5
                    , 1371.5, 1371.5, 1371.5, 1371.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1371.5, 1371.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1423.5, sellCostBuyPrice =sellCostBuyPrice+1371.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1371.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1371.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1371.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1371.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1371.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1371.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1371.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1235', userid = '1', storedetaildate = '2026-10-02 14:02:18' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '130', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1365', '1235', '1', '2026-10-02 14:02:19','0','0'); -- id=3103
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '188', '14', '81', '5.00', '19', '95', '0', '', '1', '2026-10-02 14:02:19', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','95','0','','0','0.00','0','0','0','0'); -- id=1570
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 1570;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-02', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '220', userid = '1', storedetaildate = '2026-10-02 14:02:19' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '225', '220', '1', '2026-10-02 14:02:19','0','0'); -- id=3104
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('41.28','00187', '188', '20', '187', '80.00', '48', '3840', '0', '', '1', '2026-10-02 14:02:19', '187', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','3840','0','','0','0.00','0','0','0','0'); -- id=1571
UPDATE sellbilldetail SET  lastbuyprice = 41.28 , meanbuyprice = 41.28, lastbuyprice_withDiscount = 41.28, meanbuyprice_withDiscount = 41.28
        , lastbuyprice_withTax = 41.28, meanbuyprice_withTax = 41.28, lastbuyprice_withDiscountAndTax = 41.28
                where sellbilldetailid = 1571;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (187, '2026-10-02', 3840, 3302.4, 3302.4
                    , 3302.4, 3302.4, 3302.4, 3302.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 3302.4, 3302.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3302.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3302.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3302.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3302.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3302.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3302.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3302.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3302.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 3840, 3302.4, 3302.4
                    , 3302.4, 3302.4, 3302.4, 3302.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3302.4, 3302.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3302.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3302.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3302.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3302.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3302.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3302.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3302.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3302.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '226', userid = '1', storedetaildate = '2026-10-02 14:02:19' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '80', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '306', '226', '1', '2026-10-02 14:02:19','0','0'); -- id=3105
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('118.3','00198', '188', '20', '198', '5.00', '135', '675', '0', '', '1', '2026-10-02 14:02:19', '198', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','135','675','0','','0','0.00','0','0','0','0'); -- id=1572
UPDATE sellbilldetail SET  lastbuyprice = 118.30 , meanbuyprice = 118.30, lastbuyprice_withDiscount = 118.30, meanbuyprice_withDiscount = 118.30
        , lastbuyprice_withTax = 118.3, meanbuyprice_withTax = 118.3, lastbuyprice_withDiscountAndTax = 118.3
                where sellbilldetailid = 1572;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (198, '2026-10-02', 675, 591.5, 591.5
                    , 591.5, 591.5, 591.5, 591.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 591.5, 591.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+675, sellCostBuyPrice =sellCostBuyPrice+591.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+591.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+591.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+591.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+591.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+591.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+591.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+591.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 675, 591.5, 591.5
                    , 591.5, 591.5, 591.5, 591.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 591.5, 591.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+675, sellCostBuyPrice =sellCostBuyPrice+591.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+591.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+591.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+591.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+591.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+591.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+591.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+591.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '52', userid = '1', storedetaildate = '2026-10-02 14:02:20' WHERE storedetailid = '198';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('198', '1', '5', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '57', '52', '1', '2026-10-02 14:02:20','0','0'); -- id=3106
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('188.3','00199', '188', '20', '199', '2.00', '200', '400', '0', '', '1', '2026-10-02 14:02:20', '199', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','200','400','0','','0','0.00','0','0','0','0'); -- id=1573
UPDATE sellbilldetail SET  lastbuyprice = 188.30 , meanbuyprice = 188.30, lastbuyprice_withDiscount = 188.30, meanbuyprice_withDiscount = 188.30
        , lastbuyprice_withTax = 188.3, meanbuyprice_withTax = 188.3, lastbuyprice_withDiscountAndTax = 188.3
                where sellbilldetailid = 1573;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (199, '2026-10-02', 400, 376.6, 376.6
                    , 376.6, 376.6, 376.6, 376.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 376.6, 376.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+376.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+376.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+376.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+376.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+376.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+376.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+376.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+376.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 400, 376.6, 376.6
                    , 376.6, 376.6, 376.6, 376.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 376.6, 376.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+376.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+376.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+376.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+376.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+376.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+376.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+376.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+376.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-02 14:02:20' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '25', '1', '2026-10-02 14:02:20','0','0'); -- id=3107
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('76.5','00320', '188', '7', '320', '2.00', '85', '170', '0', '', '1', '2026-10-02 14:02:20', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','170','0','','0','0.00','0','0','0','0'); -- id=1574
UPDATE sellbilldetail SET  lastbuyprice = 76.50 , meanbuyprice = 76.50, lastbuyprice_withDiscount = 76.50, meanbuyprice_withDiscount = 76.50
        , lastbuyprice_withTax = 76.5, meanbuyprice_withTax = 76.5, lastbuyprice_withDiscountAndTax = 76.5
                where sellbilldetailid = 1574;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (320, '2026-10-02', 170, 153, 153
                    , 153, 153, 153, 153
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 153, 153, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+153
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+153, sellCostMeanBuyPrice = sellCostMeanBuyPrice+153
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+153, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+153
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+153
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+153
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+153
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 170, 153, 153
                    , 153, 153, 153, 153
                    , 0, 0, 0, 0
                    , 0, 0, 0, 153, 153, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+153
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+153, sellCostMeanBuyPrice = sellCostMeanBuyPrice+153
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+153, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+153
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+153
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+153
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+153
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-02 14:02:20' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '16', '1', '2026-10-02 14:02:20','0','0'); -- id=3108
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('255','00035', '188', '8', '35', '8.00', '295', '2360', '0', '', '1', '2026-10-02 14:02:20', '35', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','2360','0','','0','0.00','0','0','0','0'); -- id=1575
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
        , lastbuyprice_withTax = 255, meanbuyprice_withTax = 255, lastbuyprice_withDiscountAndTax = 255
                where sellbilldetailid = 1575;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (35, '2026-10-02', 2360, 2040, 2040
                    , 2040, 2040, 2040, 2040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2360, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 2360, 2040, 2040
                    , 2040, 2040, 2040, 2040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2360, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 14:02:21' WHERE storedetailid = '35';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('35', '1', '8', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '28', '20', '1', '2026-10-02 14:02:21','0','0'); -- id=3109
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('329','00031', '188', '8', '31', '4.00', '410', '1640', '0', '', '1', '2026-10-02 14:02:21', '31', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','410','1640','0','','0','0.00','0','0','0','0'); -- id=1576
UPDATE sellbilldetail SET  lastbuyprice = 329.00 , meanbuyprice = 329.00, lastbuyprice_withDiscount = 329.00, meanbuyprice_withDiscount = 329.00
        , lastbuyprice_withTax = 329, meanbuyprice_withTax = 329, lastbuyprice_withDiscountAndTax = 329
                where sellbilldetailid = 1576;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (31, '2026-10-02', 1640, 1316, 1316
                    , 1316, 1316, 1316, 1316
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1316, 1316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1316, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1316
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1640, 1316, 1316
                    , 1316, 1316, 1316, 1316
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1316, 1316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1640, sellCostBuyPrice =sellCostBuyPrice+1316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1316, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1316
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-02 14:02:21' WHERE storedetailid = '31';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('31', '1', '4', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '19', '15', '1', '2026-10-02 14:02:21','0','0'); -- id=3110
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('150','00030', '188', '8', '30', '4.00', '220', '880', '0', '', '1', '2026-10-02 14:02:21', '30', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','220','880','0','','0','0.00','0','0','0','0'); -- id=1577
UPDATE sellbilldetail SET  lastbuyprice = 150.00 , meanbuyprice = 150.00, lastbuyprice_withDiscount = 150.00, meanbuyprice_withDiscount = 150.00
        , lastbuyprice_withTax = 150, meanbuyprice_withTax = 150, lastbuyprice_withDiscountAndTax = 150
                where sellbilldetailid = 1577;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (30, '2026-10-02', 880, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 880, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 14:02:21' WHERE storedetailid = '30';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('30', '1', '4', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '4', '0', '1', '2026-10-02 14:02:21','0','0'); -- id=3111
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00428', '188', '8', '428', '4.00', '395', '1580', '0', '', '1', '2026-10-02 14:02:21', '428', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','395','1580','0','','0','0.00','0','0','0','0'); -- id=1578
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 1578;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (428, '2026-10-02', 1580, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1580, sellCostBuyPrice =sellCostBuyPrice+1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1580, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1580, sellCostBuyPrice =sellCostBuyPrice+1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-10-02 14:02:22' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '4', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '50', '46', '1', '2026-10-02 14:02:22','0','0'); -- id=3112
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 32;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','00378', '188', '16', '378', '2.00', '485', '970', '0', '', '1', '2026-10-02 14:02:22', '378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','32-2,','1','1','0','0','485','970','0','','0','0.00','0','0','0','0'); -- id=1579
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 1579;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-02', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-02 14:02:22' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '31', '29', '1', '2026-10-02 14:02:22','0','0'); -- id=3113
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00513', '188', '16', '513', '1.00', '315', '315', '0', '', '1', '2026-10-02 14:02:22', '513', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','315','315','0','','0','0.00','0','0','0','0'); -- id=1580
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1580;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (513, '2026-10-02', 315, 275, 275
                    , 275, 275, 275, 275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 275, 275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+315, sellCostBuyPrice =sellCostBuyPrice+275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 315, 275, 275
                    , 275, 275, 275, 275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 275, 275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+315, sellCostBuyPrice =sellCostBuyPrice+275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2026-10-02 14:02:22' WHERE storedetailid = '513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '23', '22', '1', '2026-10-02 14:02:22','0','0'); -- id=3114
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 31;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1400','00380', '188', '16', '380', '1.00', '1650', '1650', '0', '', '1', '2026-10-02 14:02:22', '380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','31-1,','1','1','0','0','1650','1650','0','','0','0.00','0','0','0','0'); -- id=1581
UPDATE sellbilldetail SET  lastbuyprice = 1400.00 , meanbuyprice = 1400.00, lastbuyprice_withDiscount = 1400.00, meanbuyprice_withDiscount = 1400.00
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where sellbilldetailid = 1581;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (380, '2026-10-02', 1650, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1650, 1400, 1400
                    , 1400, 1400, 1400, 1400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1400, 1400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-02 14:02:23' WHERE storedetailid = '380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('380', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9', '8', '1', '2026-10-02 14:02:23','0','0'); -- id=3115
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('850','00493', '188', '16', '493', '1.00', '1050', '1050', '0', '', '1', '2026-10-02 14:02:23', '493', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1050','1050','0','','0','0.00','0','0','0','0'); -- id=1582
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 1582;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (493, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-02 14:02:23' WHERE storedetailid = '493';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('493', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-10-02 14:02:23','0','0'); -- id=3116
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00547', '188', '6', '547', '1.00', '175', '175', '0', '', '1', '2026-10-02 14:02:23', '547', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','175','175','0','','0','0.00','0','0','0','0'); -- id=1583
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 1583;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (547, '2026-10-02', 175, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+175, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 175, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+175, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 14:02:23' WHERE storedetailid = '547';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('547', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-10-02 14:02:23','0','0'); -- id=3117
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 57;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('163','00015', '188', '1', '15', '3.00', '170', '510', '0', '', '1', '2026-10-02 14:02:24', '15', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','57-3,','1','1','0','0','170','510','0','','0','0.00','0','0','0','0'); -- id=1584
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 1584;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-10-02', 510, 489, 489
                    , 489, 489, 489, 489
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 489, 489, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+510, sellCostBuyPrice =sellCostBuyPrice+489
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+489, sellCostMeanBuyPrice = sellCostMeanBuyPrice+489
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+489, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+489
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+489
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+489
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+489
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 510, 489, 489
                    , 489, 489, 489, 489
                    , 0, 0, 0, 0
                    , 0, 0, 0, 489, 489, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+510, sellCostBuyPrice =sellCostBuyPrice+489
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+489, sellCostMeanBuyPrice = sellCostMeanBuyPrice+489
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+489, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+489
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+489
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+489
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+489
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2026-10-02 14:02:24' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '3', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '105', '102', '1', '2026-10-02 14:02:24','0','0'); -- id=3118
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21','00417', '188', '10', '417', '5.00', '23.5', '117.5', '0', '', '1', '2026-10-02 14:02:24', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23.5','117.5','0','','0','0.00','0','0','0','0'); -- id=1585
UPDATE sellbilldetail SET  lastbuyprice = 21.00 , meanbuyprice = 21.00, lastbuyprice_withDiscount = 21.00, meanbuyprice_withDiscount = 21.00
        , lastbuyprice_withTax = 21, meanbuyprice_withTax = 21, lastbuyprice_withDiscountAndTax = 21
                where sellbilldetailid = 1585;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (417, '2026-10-02', 117.5, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117.5, sellCostBuyPrice =sellCostBuyPrice+105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 117.5, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+117.5, sellCostBuyPrice =sellCostBuyPrice+105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 14:02:24' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '5', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '20', '1', '2026-10-02 14:02:24','0','0'); -- id=3119
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('221','00020', '188', '1', '20', '1.00', '230', '230', '0', '', '1', '2026-10-02 14:02:24', '20', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','230','230','0','','0','0.00','0','0','0','0'); -- id=1586
UPDATE sellbilldetail SET  lastbuyprice = 221.00 , meanbuyprice = 221.00, lastbuyprice_withDiscount = 221.00, meanbuyprice_withDiscount = 221.00
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where sellbilldetailid = 1586;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-10-02', 230, 221, 221
                    , 221, 221, 221, 221
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 221, 221, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+221
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+221, sellCostMeanBuyPrice = sellCostMeanBuyPrice+221
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+221, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+221
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+221
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+221
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+221
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 230, 221, 221
                    , 221, 221, 221, 221
                    , 0, 0, 0, 0
                    , 0, 0, 0, 221, 221, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+221
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+221, sellCostMeanBuyPrice = sellCostMeanBuyPrice+221
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+221, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+221
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+221
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+221
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+221
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-02 14:02:24' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '9', '1', '2026-10-02 14:02:25','0','0'); -- id=3120
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('303','00033', '188', '8', '33', '4.00', '375', '1500', '0', '', '1', '2026-10-02 14:02:25', '33', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','375','1500','0','','0','0.00','0','0','0','0'); -- id=1587
UPDATE sellbilldetail SET  lastbuyprice = 303.00 , meanbuyprice = 303.00, lastbuyprice_withDiscount = 303.00, meanbuyprice_withDiscount = 303.00
        , lastbuyprice_withTax = 303, meanbuyprice_withTax = 303, lastbuyprice_withDiscountAndTax = 303
                where sellbilldetailid = 1587;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (33, '2026-10-02', 1500, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1500, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-02 14:02:25' WHERE storedetailid = '33';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('33', '1', '4', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '19', '15', '1', '2026-10-02 14:02:25','0','0'); -- id=3121
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 73;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00160', '188', '22', '160', '2.00', '150', '300', '0', '', '1', '2026-10-02 14:02:25', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','73-2,','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1588
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 1588;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-02', 300, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 300, 240, 240
                    , 240, 240, 240, 240
                    , 0, 0, 0, 0
                    , 0, 0, 0, 240, 240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '103', userid = '1', storedetaildate = '2026-10-02 14:02:25' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '105', '103', '1', '2026-10-02 14:02:25','0','0'); -- id=3122
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 71;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '188', '1', '9', '1.00', '319', '319', '0', '', '1', '2026-10-02 14:02:25', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-1,','1','1','0','0','319','319','0','','0','0.00','0','0','0','0'); -- id=1589
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 1589;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-02', 319, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+319, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 319, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+319, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-02 14:02:26' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '54', '53', '1', '2026-10-02 14:02:26','0','0'); -- id=3123
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('37','00117', '188', '3', '117', '2.00', '39', '78', '0', '', '1', '2026-10-02 14:02:26', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','78','0','','0','0.00','0','0','0','0'); -- id=1590
UPDATE sellbilldetail SET  lastbuyprice = 37.00 , meanbuyprice = 37.00, lastbuyprice_withDiscount = 37.00, meanbuyprice_withDiscount = 37.00
        , lastbuyprice_withTax = 37, meanbuyprice_withTax = 37, lastbuyprice_withDiscountAndTax = 37
                where sellbilldetailid = 1590;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (117, '2026-10-02', 78, 74, 74
                    , 74, 74, 74, 74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 74, 74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 78, 74, 74
                    , 74, 74, 74, 74
                    , 0, 0, 0, 0
                    , 0, 0, 0, 74, 74, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+74
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+74, sellCostMeanBuyPrice = sellCostMeanBuyPrice+74
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+74, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+74
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+74
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+74
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+74
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-02 14:02:26' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '25', '1', '2026-10-02 14:02:26','0','0'); -- id=3124
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 85;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('61.5','00434', '188', '3', '434', '3.00', '64.5', '193.5', '0', '', '1', '2026-10-02 14:02:26', '434', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','85-3,','1','1','0','0','64.5','193.5','0','','0','0.00','0','0','0','0'); -- id=1591
UPDATE sellbilldetail SET  lastbuyprice = 61.50 , meanbuyprice = 61.50, lastbuyprice_withDiscount = 61.50, meanbuyprice_withDiscount = 61.50
        , lastbuyprice_withTax = 61.5, meanbuyprice_withTax = 61.5, lastbuyprice_withDiscountAndTax = 61.5
                where sellbilldetailid = 1591;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (434, '2026-10-02', 193.5, 184.5, 184.5
                    , 184.5, 184.5, 184.5, 184.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 184.5, 184.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+193.5, sellCostBuyPrice =sellCostBuyPrice+184.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 193.5, 184.5, 184.5
                    , 184.5, 184.5, 184.5, 184.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.5, 184.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+193.5, sellCostBuyPrice =sellCostBuyPrice+184.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-02 14:02:26' WHERE storedetailid = '434';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('434', '1', '3', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '29', '1', '2026-10-02 14:02:26','0','0'); -- id=3125
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13','00190', '188', '20', '190', '7.00', '15', '105', '0', '', '1', '2026-10-02 14:02:26', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','105','0','','0','0.00','0','0','0','0'); -- id=1592
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 1592;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-10-02', 105, 91, 91
                    , 91, 91, 91, 91
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 91, 91, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+105, sellCostBuyPrice =sellCostBuyPrice+91
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+91, sellCostMeanBuyPrice = sellCostMeanBuyPrice+91
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+91, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+91
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+91
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+91
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 105, 91, 91
                    , 91, 91, 91, 91
                    , 0, 0, 0, 0
                    , 0, 0, 0, 91, 91, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+105, sellCostBuyPrice =sellCostBuyPrice+91
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+91, sellCostMeanBuyPrice = sellCostMeanBuyPrice+91
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+91, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+91
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+91
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+91
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '236', userid = '1', storedetaildate = '2026-10-02 14:02:27' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '7', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '243', '236', '1', '2026-10-02 14:02:27','0','0'); -- id=3126
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14','00275', '188', '10', '275', '20.00', '17', '340', '0', '', '1', '2026-10-02 14:02:27', '275', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17','340','0','','0','0.00','0','0','0','0'); -- id=1593
UPDATE sellbilldetail SET  lastbuyprice = 22.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 22.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 22
                where sellbilldetailid = 1593;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (275, '2026-10-02', 340, 280, 440
                    , 360, 440, 360, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 340, 280, 440
                    , 360, 440, 360, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-02 14:02:27' WHERE storedetailid = '275';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '1', '20', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '10', '1', '2026-10-02 14:02:27','0','0'); -- id=3127
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 11;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '188', '3', '102', '7.00', '12', '84', '0', '', '1', '2026-10-02 14:02:27', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-7,','1','1','0','0','12','84','0','','0','0.00','0','0','0','0'); -- id=1594
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 1594;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-02', 84, 82.25, 82.25
                    , 82.25, 82.25, 82.25, 82.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 82.25, 82.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+84, sellCostBuyPrice =sellCostBuyPrice+82.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 84, 82.25, 82.25
                    , 82.25, 82.25, 82.25, 82.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 82.25, 82.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+84, sellCostBuyPrice =sellCostBuyPrice+82.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1251', userid = '1', storedetaildate = '2026-10-02 14:02:27' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '7', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1258', '1251', '1', '2026-10-02 14:02:27','0','0'); -- id=3128
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 8;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '188', '3', '103', '12.00', '5.5', '66', '0', '', '1', '2026-10-02 14:02:27', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-12,','1','1','0','0','5.5','66','0','','0','0.00','0','0','0','0'); -- id=1595
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 1595;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-02', 66, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+66, sellCostBuyPrice =sellCostBuyPrice+54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 66, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+66, sellCostBuyPrice =sellCostBuyPrice+54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1908', userid = '1', storedetaildate = '2026-10-02 14:02:28' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '12', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1920', '1908', '1', '2026-10-02 14:02:28','0','0'); -- id=3129
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('385','00267', '188', '10', '267', '1.00', '420', '420', '0', '', '1', '2026-10-02 14:02:28', '267', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','420','420','0','','0','0.00','0','0','0','0'); -- id=1596
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where sellbilldetailid = 1596;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (267, '2026-10-02', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 14:02:28' WHERE storedetailid = '267';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '4', '3', '1', '2026-10-02 14:02:28','0','0'); -- id=3130
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('107.52','00184', '188', '20', '184', '1.00', '115', '115', '0', '', '1', '2026-10-02 14:02:28', '184', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','115','115','0','','0','0.00','0','0','0','0'); -- id=1597
UPDATE sellbilldetail SET  lastbuyprice = 107.52 , meanbuyprice = 107.52, lastbuyprice_withDiscount = 107.52, meanbuyprice_withDiscount = 107.52
        , lastbuyprice_withTax = 107.52, meanbuyprice_withTax = 107.52, lastbuyprice_withDiscountAndTax = 107.52
                where sellbilldetailid = 1597;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (184, '2026-10-02', 115, 107.52, 107.52
                    , 107.52, 107.52, 107.52, 107.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 107.52, 107.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+107.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+107.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+107.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+107.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+107.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+107.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+107.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+107.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 115, 107.52, 107.52
                    , 107.52, 107.52, 107.52, 107.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 107.52, 107.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+107.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+107.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+107.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+107.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+107.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+107.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+107.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+107.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '206', userid = '1', storedetaildate = '2026-10-02 14:02:28' WHERE storedetailid = '184';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('184', '1', '1', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '207', '206', '1', '2026-10-02 14:02:28','0','0'); -- id=3131
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.72','00182', '188', '20', '182', '2.00', '48', '96', '0', '', '1', '2026-10-02 14:02:29', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','96','0','','0','0.00','0','0','0','0'); -- id=1598
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 1598;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-02', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '855', userid = '1', storedetaildate = '2026-10-02 14:02:29' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '2', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '857', '855', '1', '2026-10-02 14:02:29','0','0'); -- id=3132
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 96;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '188', '3', '100', '4.00', '17.75', '71', '0', '', '1', '2026-10-02 14:02:29', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','96-4,','1','1','0','0','17.75','71','0','','0','0.00','0','0','0','0'); -- id=1599
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 1599;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-02', 71, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 70.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 70.4, 70.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+71, sellCostBuyPrice =sellCostBuyPrice+70.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 71, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 70.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70.4, 70.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+71, sellCostBuyPrice =sellCostBuyPrice+70.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '596', userid = '1', storedetaildate = '2026-10-02 14:02:29' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '4', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '600', '596', '1', '2026-10-02 14:02:29','0','0'); -- id=3133
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('240','00556', '188', '1', '556', '3.00', '249.5', '748.5', '0', '', '1', '2026-10-02 14:02:29', '556', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','249.5','748.5','0','','0','0.00','0','0','0','0'); -- id=1600
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 240
                where sellbilldetailid = 1600;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (556, '2026-10-02', 748.5, 720, 720
                    , 720, 720, 720, 720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+748.5, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 748.5, 720, 720
                    , 720, 720, 720, 720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 720, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+748.5, sellCostBuyPrice =sellCostBuyPrice+720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-02 14:02:30' WHERE storedetailid = '556';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('556', '1', '3', '1', '188', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-10-02 14:02:30','0','0'); -- id=3134
UPDATE dailyentry SET totalcreditor = '36783.00', totaldebtor = '36783.00', thedate = '2026-10-01', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-01 19:08:24', entryComment = 'اضافة فاتورة مبيعات رقم 186', fromFlag = '1',related='0',isopeningentry='0',operationId='186',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=186' WHERE id = '1185';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '36783.00', '36783.00', '2026-10-02', '1', '0', '1185', '2026-10-02 14:02:30','تم عكس القيد رقم 1185 ','1','0','0','0','0',''); -- id=1198
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1198', '474', '36783.00', '','0'); -- id=1199
UPDATE accountstree SET name = 'طارق فرج الشيخ ', customName = 'طارق فرج الشيخ ', customNameEn = 'طارق فرج الشيخ ', nameEn = 'طارق فرج الشيخ ', parent = '58', accountNature = '0', theValue = '-3976.7', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 10:01:32' WHERE id = '474';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1198', '143', '36783.00', '','0'); -- id=1200
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '684293.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '32554.90', totaldebtor = '32554.90', thedate = '2026-10-01', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-01 19:08:24', entryComment = 'اضافة فاتورة مبيعات رقم 186 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='186',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=186' WHERE id = '1186';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '32554.90', '32554.90', '2026-10-02', '1', '0', '1186', '2026-10-02 14:02:30','تم عكس القيد رقم 1186 ','1','0','0','0','0',''); -- id=1199
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1199', '402', '32554.90', '','0'); -- id=1200
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '625451.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1199', '382', '32554.90', '','0'); -- id=1201
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2662122.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '36783', '36783', '2026-10-02', '1', '0', '0', '2026-10-02 14:02:31','اضافة فاتورة مبيعات رقم 188','1','0',null,'0','188','sellbillController.php?do=showDetail&sellbillid=188'); -- id=1200
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1200', '474', '36783', '','0'); -- id=1202
UPDATE accountstree SET name = 'طارق فرج الشيخ ', customName = 'طارق فرج الشيخ ', customNameEn = 'طارق فرج الشيخ ', nameEn = 'طارق فرج الشيخ ', parent = '58', accountNature = '0', theValue = '32806.3', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 10:01:32' WHERE id = '474';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1200', '143', '36783', '','0'); -- id=1201
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '721076.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '32554.9', '32554.9', '2026-10-02', '1', '0', '0', '2026-10-02 14:02:31','اضافة فاتورة مبيعات رقم 188 - صرف البضاعة من المخزن','1','0',null,'0','188','sellbillController.php?do=showDetail&sellbillid=188'); -- id=1201
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1201', '402', '32554.9', '','0'); -- id=1203
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '658006.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1201', '382', '32554.9', '','0'); -- id=1202
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2629567.12', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1200,0,1201' where sellbillid=188;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,32474.9, 32470.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36783, sellCostBuyPrice =sellCostBuyPrice+32394.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32554.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32470.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32554.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32470.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32554.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32474.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32470.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-02', 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,32474.9, 32470.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36783, sellCostBuyPrice =sellCostBuyPrice+32394.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32554.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32470.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32554.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32470.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32554.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32474.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32470.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 36783, 32394.9, 32554.9
                    , 32470.9, 32554.9, 32470.9, 32554.9, 32474.9, 32470.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+36783, netSellCostBuyPrice = netSellCostBuyPrice+32394.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+32554.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+32470.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+32554.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+32470.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+32554.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+32474.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+32470.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 186 and newid=188 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:32:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:02:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:02:32', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=188'); -- id=3208
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 10:38:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 14:08:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 14:08:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3209
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 12:16:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 15:46:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 15:46:12', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3210
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 12:16:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 15:46:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 15:46:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3211
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 12:16:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 15:46:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 15:46:35', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=174'); -- id=3212
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 12:17:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 15:47:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 15:47:09', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3213
BEGIN;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - with id = 174 and  = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete start with id = 174 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 174;
UPDATE sellbill SET  sellbillsysdate = '2026-10-02 15:47:10', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '174';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 110;
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1320;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-10-02', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '70', '78', '1', '2026-09-26 16:55:00','0','0'); -- id=3135
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 1321;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-10-02', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '697', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '681', '697', '1', '2026-09-26 16:55:00','0','0'); -- id=3136
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 1322;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-02', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '870', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '855', '870', '1', '2026-09-26 16:55:00','0','0'); -- id=3137
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1323;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-10-02', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=3138
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-10-02', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=3139
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1325;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-10-02', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 15:47:10' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3140
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-10-02', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3141
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-02', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3142
UPDATE sellbilldetail SET  lastbuyprice = 157.00 , meanbuyprice = 157.00, lastbuyprice_withDiscount = 157.00, meanbuyprice_withDiscount = 157.00
        , lastbuyprice_withTax = 157, meanbuyprice_withTax = 157, lastbuyprice_withDiscountAndTax = 157
                where sellbilldetailid = 1328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (531, '2026-10-02', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0,44,0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7700, sellCostBuyPrice =sellCostBuyPrice-6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6908
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-44
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7700, sellCostBuyPrice =sellCostBuyPrice-6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6908
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '44', '1', '2026-09-26 16:55:00','0','0'); -- id=3143
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.00, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.00
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1329;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-02', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1320, sellCostBuyPrice =sellCostBuyPrice-1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1320, sellCostBuyPrice =sellCostBuyPrice-1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '15', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '110', '125', '1', '2026-09-26 16:55:00','0','0'); -- id=3144
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 24;
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 1330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (108, '2026-10-02', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1236, sellCostBuyPrice =sellCostBuyPrice-1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1212
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1236, sellCostBuyPrice =sellCostBuyPrice-1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1212
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '12', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '32', '1', '2026-09-26 16:55:00','0','0'); -- id=3145
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (111, '2026-10-02', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-696, sellCostMeanBuyPrice = sellCostMeanBuyPrice-696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-696
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-696, sellCostMeanBuyPrice = sellCostMeanBuyPrice-696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-696
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '6', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '27', '1', '2026-09-26 16:55:00','0','0'); -- id=3146
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (112, '2026-10-02', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-464, sellCostMeanBuyPrice = sellCostMeanBuyPrice-464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-464
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-464, sellCostMeanBuyPrice = sellCostMeanBuyPrice-464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-464
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '4', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3147
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 1333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (450, '2026-10-02', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39, sellCostMeanBuyPrice = sellCostMeanBuyPrice-39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-39
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39, sellCostMeanBuyPrice = sellCostMeanBuyPrice-39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-39
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '3', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '3', '1', '2026-09-26 16:55:00','0','0'); -- id=3148
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 34;
UPDATE sellbilldetail SET  lastbuyprice = 12.00 , meanbuyprice = 12.00, lastbuyprice_withDiscount = 12.00, meanbuyprice_withDiscount = 12.00
        , lastbuyprice_withTax = 12, meanbuyprice_withTax = 12, lastbuyprice_withDiscountAndTax = 12
                where sellbilldetailid = 1334;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (344, '2026-10-02', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-24, sellCostMeanBuyPrice = sellCostMeanBuyPrice-24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-24
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-24, sellCostMeanBuyPrice = sellCostMeanBuyPrice-24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-24
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '2', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '30', '1', '2026-09-26 16:55:00','0','0'); -- id=3149
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 1335;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (343, '2026-10-02', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-40, sellCostBuyPrice =sellCostBuyPrice-35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-40, sellCostBuyPrice =sellCostBuyPrice-35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '1', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '25', '1', '2026-09-26 16:55:00','0','0'); -- id=3150
UPDATE sellbilldetail SET  lastbuyprice = 32.00 , meanbuyprice = 32.00, lastbuyprice_withDiscount = 32.00, meanbuyprice_withDiscount = 32.00
        , lastbuyprice_withTax = 32, meanbuyprice_withTax = 32, lastbuyprice_withDiscountAndTax = 32
                where sellbilldetailid = 1336;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (440, '2026-10-02', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-64, sellCostMeanBuyPrice = sellCostMeanBuyPrice-64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-64
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-64, sellCostMeanBuyPrice = sellCostMeanBuyPrice-64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-64
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '209', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '2', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '207', '209', '1', '2026-09-26 16:55:00','0','0'); -- id=3151
UPDATE sellbilldetail SET  lastbuyprice = 3.50 , meanbuyprice = 3.50, lastbuyprice_withDiscount = 3.50, meanbuyprice_withDiscount = 3.50
        , lastbuyprice_withTax = 3.5, meanbuyprice_withTax = 3.5, lastbuyprice_withDiscountAndTax = 3.5
                where sellbilldetailid = 1337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (446, '2026-10-02', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-21, sellCostMeanBuyPrice = sellCostMeanBuyPrice-21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-21
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-21, sellCostMeanBuyPrice = sellCostMeanBuyPrice-21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-21
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '245', userid = '1', storedetaildate = '2026-10-02 15:47:11' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '6', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '239', '245', '1', '2026-09-26 16:55:00','0','0'); -- id=3152
UPDATE sellbilldetail SET  lastbuyprice = 20.00 , meanbuyprice = 20.00, lastbuyprice_withDiscount = 20.00, meanbuyprice_withDiscount = 20.00
        , lastbuyprice_withTax = 20, meanbuyprice_withTax = 20, lastbuyprice_withDiscountAndTax = 20
                where sellbilldetailid = 1338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (525, '2026-10-02', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-115, sellCostBuyPrice =sellCostBuyPrice-100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-115, sellCostBuyPrice =sellCostBuyPrice-100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-02 15:47:12' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '5', '0', '174', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '24', '1', '2026-09-26 16:55:00','0','0'); -- id=3153
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-16268.9', userid = '1' WHERE clientid = '5';
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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','6623.10','22892.00','1','تعديل فاتورة مبيعات','174', '-16268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '22892', '0', null, '0', null, null,'', '0','1','1','22892','1','2026-09-26 16:55:00','0','0','',''); -- id=323
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20360.12, 20288.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22892, sellCostBuyPrice =sellCostBuyPrice-20360.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20360.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20288.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20360.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20288.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20360.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20360.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20288.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-02', 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20360.12, 20288.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22892, sellCostBuyPrice =sellCostBuyPrice-20360.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20360.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20288.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20360.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20288.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20360.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20360.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20288.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12, 20360.12, 20288.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-22892, netSellCostBuyPrice = netSellCostBuyPrice-20360.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-20360.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-20288.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-20360.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-20288.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-20360.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-20360.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-20288.12;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete end - with id = 174 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 174 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
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,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '-16268.90', '7151.1', '0', '1', '23420', '23420', '0', '23420', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '153', '174', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=189
UPDATE client SET  clientdebt = '7151.1', userid = '1' WHERE clientid = '5';
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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','-16268.90','23420','0','اضافة فاتورة مبيعات (معدله)','189', '7151.1', '2026-10-02 15:47:13', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '23420', '0', null, '0', null, null,'', '0','1','1','22892','1','2026-09-26 16:55:00','0','0','',''); -- id=324
UPDATE client SET  inUse = 0 where clientid = 5;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 110;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00208', '189', '10', '208', '8.00', '1210', '9680', '0', '', '1', '2026-10-02 15:47:13', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-8,','1','1','0','0','1210','9680','0','','0','0.00','0','0','0','0'); -- id=1601
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1601;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-10-02', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2026-10-02 15:47:13' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '78', '70', '1', '2026-10-02 15:47:13','0','0'); -- id=3154
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6.5','00315', '189', '6', '315', '16.00', '8', '128', '0', '', '1', '2026-10-02 15:47:13', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','128','0','','0','0.00','0','0','0','0'); -- id=1602
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 1602;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-10-02', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '681', userid = '1', storedetaildate = '2026-10-02 15:47:13' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '697', '681', '1', '2026-10-02 15:47:13','0','0'); -- id=3155
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.72','00182', '189', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-10-02 15:47:13', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=1603
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 1603;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-02', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '855', userid = '1', storedetaildate = '2026-10-02 15:47:14' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '870', '855', '1', '2026-10-02 15:47:14','0','0'); -- id=3156
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '189', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-10-02 15:47:14', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=1604
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1604;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-10-02', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-10-02 15:47:14' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-10-02 15:47:14','0','0'); -- id=3157
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '189', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-10-02 15:47:14', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1605
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1605;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-10-02', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-10-02 15:47:14' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-10-02 15:47:14','0','0'); -- id=3158
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8','00530', '189', '6', '530', '1.00', '10', '10', '0', '', '1', '2026-10-02 15:47:14', '530', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=1606
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1606;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-10-02', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-02 15:47:15' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-10-02 15:47:15','0','0'); -- id=3159
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '189', '6', '529', '3.00', '26', '78', '0', '', '1', '2026-10-02 15:47:15', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','78','0','','0','0.00','0','0','0','0'); -- id=1607
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1607;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-10-02', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-10-02 15:47:15' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '17', '1', '2026-10-02 15:47:15','0','0'); -- id=3160
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '189', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-10-02 15:47:15', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1608
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1608;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-02', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-02 15:47:15' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-10-02 15:47:15','0','0'); -- id=3161
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157','00531', '189', '10', '531', '44.00', '175', '7700', '0', '', '1', '2026-10-02 15:47:16', '531', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','175','7700','0','','0','0.00','0','0','0','0'); -- id=1609
UPDATE sellbilldetail SET  lastbuyprice = 157.00 , meanbuyprice = 157.00, lastbuyprice_withDiscount = 157.00, meanbuyprice_withDiscount = 157.00
        , lastbuyprice_withTax = 157, meanbuyprice_withTax = 157, lastbuyprice_withDiscountAndTax = 157
                where sellbilldetailid = 1609;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (531, '2026-10-02', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+44
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 15:47:16' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '0', '1', '2026-10-02 15:47:16','0','0'); -- id=3162
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00002', '189', '10', '2', '15.00', '88', '1320', '0', '', '1', '2026-10-02 15:47:16', '2', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','88','1320','0','','0','0.00','0','0','0','0'); -- id=1610
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.00, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.00
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1610;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-02', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-10-02 15:47:16' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '15', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '110', '1', '2026-10-02 15:47:16','0','0'); -- id=3163
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 24;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00108', '189', '3', '108', '12.00', '103', '1236', '0', '', '1', '2026-10-02 15:47:16', '108', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','24-9,','1','1','0','0','103','1236','0','','0','0.00','0','0','0','0'); -- id=1611
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 1611;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (108, '2026-10-02', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1236, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1236, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 15:47:16' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '12', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '20', '1', '2026-10-02 15:47:17','0','0'); -- id=3164
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('116','00111', '189', '3', '111', '6.00', '120', '720', '0', '', '1', '2026-10-02 15:47:17', '111', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','720','0','','0','0.00','0','0','0','0'); -- id=1612
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1612;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (111, '2026-10-02', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+696
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+696
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-02 15:47:17' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '6', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '21', '1', '2026-10-02 15:47:17','0','0'); -- id=3165
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('116','00112', '189', '3', '112', '4.00', '120', '480', '0', '', '1', '2026-10-02 15:47:17', '112', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','480','0','','0','0.00','0','0','0','0'); -- id=1613
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1613;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (112, '2026-10-02', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+464, sellCostMeanBuyPrice = sellCostMeanBuyPrice+464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+464
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+464, sellCostMeanBuyPrice = sellCostMeanBuyPrice+464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+464
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-02 15:47:17' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '4', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '16', '1', '2026-10-02 15:47:17','0','0'); -- id=3166
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13','00450', '189', '6', '450', '3.00', '15', '45', '0', '', '1', '2026-10-02 15:47:17', '450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=1614
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 1614;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (450, '2026-10-02', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39, sellCostMeanBuyPrice = sellCostMeanBuyPrice+39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39, sellCostMeanBuyPrice = sellCostMeanBuyPrice+39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 15:47:18' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '3', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '0', '1', '2026-10-02 15:47:18','0','0'); -- id=3167
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 34;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('12','00344', '189', '6', '344', '2.00', '15', '30', '0', '', '1', '2026-10-02 15:47:18', '344', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','34-2,','1','1','0','0','15','30','0','','0','0.00','0','0','0','0'); -- id=1615
UPDATE sellbilldetail SET  lastbuyprice = 12.00 , meanbuyprice = 12.00, lastbuyprice_withDiscount = 12.00, meanbuyprice_withDiscount = 12.00
        , lastbuyprice_withTax = 12, meanbuyprice_withTax = 12, lastbuyprice_withDiscountAndTax = 12
                where sellbilldetailid = 1615;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (344, '2026-10-02', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-02 15:47:18' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '2', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '28', '1', '2026-10-02 15:47:18','0','0'); -- id=3168
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35','00343', '189', '6', '343', '1.00', '40', '40', '0', '', '1', '2026-10-02 15:47:18', '343', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','40','40','0','','0','0.00','0','0','0','0'); -- id=1616
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 1616;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (343, '2026-10-02', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-02 15:47:18' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '1', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '24', '1', '2026-10-02 15:47:18','0','0'); -- id=3169
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('32','00440', '189', '12', '440', '2.00', '36', '72', '0', '', '1', '2026-10-02 15:47:18', '440', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','72','0','','0','0.00','0','0','0','0'); -- id=1617
UPDATE sellbilldetail SET  lastbuyprice = 32.00 , meanbuyprice = 32.00, lastbuyprice_withDiscount = 32.00, meanbuyprice_withDiscount = 32.00
        , lastbuyprice_withTax = 32, meanbuyprice_withTax = 32, lastbuyprice_withDiscountAndTax = 32
                where sellbilldetailid = 1617;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (440, '2026-10-02', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '1', storedetaildate = '2026-10-02 15:47:19' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '2', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '209', '207', '1', '2026-10-02 15:47:19','0','0'); -- id=3170
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('3.5','00446', '189', '12', '446', '6.00', '5', '30', '0', '', '1', '2026-10-02 15:47:19', '446', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5','30','0','','0','0.00','0','0','0','0'); -- id=1618
UPDATE sellbilldetail SET  lastbuyprice = 3.50 , meanbuyprice = 3.50, lastbuyprice_withDiscount = 3.50, meanbuyprice_withDiscount = 3.50
        , lastbuyprice_withTax = 3.5, meanbuyprice_withTax = 3.5, lastbuyprice_withDiscountAndTax = 3.5
                where sellbilldetailid = 1618;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (446, '2026-10-02', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '239', userid = '1', storedetaildate = '2026-10-02 15:47:19' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '6', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '245', '239', '1', '2026-10-02 15:47:19','0','0'); -- id=3171
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('20','00525', '189', '6', '525', '5.00', '23', '115', '0', '', '1', '2026-10-02 15:47:19', '525', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','115','0','','0','0.00','0','0','0','0'); -- id=1619
UPDATE sellbilldetail SET  lastbuyprice = 20.00 , meanbuyprice = 20.00, lastbuyprice_withDiscount = 20.00, meanbuyprice_withDiscount = 20.00
        , lastbuyprice_withTax = 20, meanbuyprice_withTax = 20, lastbuyprice_withDiscountAndTax = 20
                where sellbilldetailid = 1619;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (525, '2026-10-02', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-02 15:47:19' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '5', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '19', '1', '2026-10-02 15:47:19','0','0'); -- id=3172
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00002', '189', '10', '2', '6', '88', '528', '0', '', '1', '2026-10-02 15:47:19', '2', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','88','528','0','','0','0.00','0','0','0','0'); -- id=1620
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.00, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.00
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1620;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-02', 528, 480, 480
                    , 480, 480, 480, 480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 480, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 528, 480, 480
                    , 480, 480, 480, 480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 480, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+528, sellCostBuyPrice =sellCostBuyPrice+480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '104', userid = '1', storedetaildate = '2026-10-02 15:47:20' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '6', '1', '189', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '110', '104', '1', '2026-10-02 15:47:20','0','0'); -- id=3173
UPDATE dailyentry SET totalcreditor = '22892.00', totaldebtor = '22892.00', thedate = '2026-09-30', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-30 15:53:44', entryComment = 'اضافة فاتورة مبيعات رقم 174', fromFlag = '1',related='0',isopeningentry='0',operationId='174',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=174' WHERE id = '1131';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22892.00', '22892.00', '2026-10-02', '1', '0', '1131', '2026-10-02 15:47:20','تم عكس القيد رقم 1131 ','1','0','0','0','0',''); -- id=1202
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1202', '430', '22892.00', '','0'); -- id=1203
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '-16268.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1202', '143', '22892.00', '','0'); -- id=1204
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '698184.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '20360.12', totaldebtor = '20360.12', thedate = '2026-09-30', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-30 15:53:44', entryComment = 'اضافة فاتورة مبيعات رقم 174 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='174',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=174' WHERE id = '1132';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20360.12', '20360.12', '2026-10-02', '1', '0', '1132', '2026-10-02 15:47:20','تم عكس القيد رقم 1132 ','1','0','0','0','0',''); -- id=1203
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1203', '402', '20360.12', '','0'); -- id=1204
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '637646.35', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1203', '382', '20360.12', '','0'); -- id=1205
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2649927.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23420', '23420', '2026-10-02', '1', '0', '0', '2026-10-02 15:47:21','اضافة فاتورة مبيعات رقم 189','1','0',null,'0','189','sellbillController.php?do=showDetail&sellbillid=189'); -- id=1204
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1204', '430', '23420', '','0'); -- id=1206
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '7151.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1204', '143', '23420', '','0'); -- id=1205
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '721604.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20840.12', '20840.12', '2026-10-02', '1', '0', '0', '2026-10-02 15:47:21','اضافة فاتورة مبيعات رقم 189 - صرف البضاعة من المخزن','1','0',null,'0','189','sellbillController.php?do=showDetail&sellbillid=189'); -- id=1205
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1205', '402', '20840.12', '','0'); -- id=1207
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '658486.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1205', '382', '20840.12', '','0'); -- id=1206
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2629087.12', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1204,0,1205' where sellbillid=189;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 23420, 20840.12, 20840.12
                    , 20768.12, 20840.12, 20768.12, 20840.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20840.12, 20768.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23420, sellCostBuyPrice =sellCostBuyPrice+20840.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20840.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20768.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20840.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20768.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20840.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20840.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20768.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-02', 23420, 20840.12, 20840.12
                    , 20768.12, 20840.12, 20768.12, 20840.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20840.12, 20768.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23420, sellCostBuyPrice =sellCostBuyPrice+20840.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20840.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20768.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20840.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20768.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20840.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20840.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20768.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 23420, 20840.12, 20840.12
                    , 20768.12, 20840.12, 20768.12, 20840.12, 20840.12, 20768.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+23420, netSellCostBuyPrice = netSellCostBuyPrice+20840.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20840.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20768.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20840.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20768.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20840.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+20840.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+20768.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 174 and newid=189 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 12:17:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 15:47:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 15:47:22', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=189'); -- id=3214
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:25:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 17:55:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 17:55:31', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3215
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:25:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 17:55:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 17:55:34', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:26:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 17:56:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 17:56:03', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3217
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,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('ابليك ريشه ','','16','285','325','325','325','2026-10-02','0','1','0','','0','0','0','0','0','285','285','285','285','285','0','14.04','14.04','14.04','.','0','0','0','285','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','285','285','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','285','0','0','0','0','0','0','','','0','0','0','0'); -- id=558
UPDATE product SET productName = 'ابليك ريشه ', productDescription = '', productCatId = '16', productBuyPrice = '285', productSellAllPrice = '325', productSellUnitPrice = '325', productSellHalfPrice = '325', productDate = '2026-10-02', conditions = '0', userId = '1', limitamount = '0', parcode = '00558',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '285',lastbuyprice_withDiscount = '285',meanbuyprice = '285',meanbuyprice_withDiscount = '285' , productbuypricereal = '285' , buypricereal_precentage = '0' , buytotal_precentage = '14.04' , buyhalf_precentage = '14.04' , buypart_precentage = '14.04',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='285',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='285',meanbuyprice_withTax='285',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='285',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '558';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '558', '1.00', '2026-10-02', '1', '0','0055801','325','325','325','285','','0','0','0','0','0','0','0','0','0','0'); -- id=558
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('558', '1', '16', '1', '2026-10-02'); -- id=558
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('558', '1', '16', '0', '558', 'إضافة منتج', 'productController.php', '0', '16', '1', '2026-10-02','0','0'); -- id=3174
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (558, 1,'2026-10-02 17:56:05',1)
                ON DUPLICATE KEY UPDATE productid = 558, edited = 1, sysdate = '2026-10-02 17:56:05', userid = 1; -- id=710
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4560', '4560', '2026-10-02', '1', '0', '0', '2026-10-02 17:56:05','إضافة منتج ابليك ريشه  الكمية 16','1','0','0','0','558','productController.php?do=edit&id=558'); -- id=1206
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1206', '382', '4560', '','0'); -- id=1208
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2633647.12', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1206', '121', '4560', '','0'); -- id=1207
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1652536.77', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'ابليك ريشه ', productDescription = '', productCatId = '16', productBuyPrice = '285.00', productSellAllPrice = '325.00', productSellUnitPrice = '325.00', productSellHalfPrice = '325.00', productDate = '2026-10-02', conditions = '0', userId = '1', limitamount = '0', parcode = '00558',type ='0', expireDate = '0' , dailyentryId = '1206',isService = '0',isOptic = '0',lastbuyprice = '285',lastbuyprice_withDiscount = '285',meanbuyprice = '285',meanbuyprice_withDiscount = '285' , productbuypricereal = '285' , buypricereal_precentage = '0' , buytotal_precentage = '14.04' , buyhalf_precentage = '14.04' , buypart_precentage = '14.04',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='285',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='285',meanbuyprice_withTax='285',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='285',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '558';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:26:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 17:56:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 17:56:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3218
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:31:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 18:01:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 18:01:12', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3219
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,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('وش شامبين ','','3','15','19','19','19','2026-10-02','0','1','0','','0','0','0','0','0','15','15','15','15','15','0','26.67','26.67','26.67','.','0','0','0','15','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','15','15','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','15','0','0','0','0','0','0','','','0','0','0','0'); -- id=559
UPDATE product SET productName = 'وش شامبين ', productDescription = '', productCatId = '3', productBuyPrice = '15', productSellAllPrice = '19', productSellUnitPrice = '19', productSellHalfPrice = '19', productDate = '2026-10-02', conditions = '0', userId = '1', limitamount = '0', parcode = '00559',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '15',lastbuyprice_withDiscount = '15',meanbuyprice = '15',meanbuyprice_withDiscount = '15' , productbuypricereal = '15' , buypricereal_precentage = '0' , buytotal_precentage = '26.67' , buyhalf_precentage = '26.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='15',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='15',meanbuyprice_withTax='15',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='15',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '559';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '559', '1.00', '2026-10-02', '1', '0','0055901','19','19','19','15','','0','0','0','0','0','0','0','0','0','0'); -- id=559
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('559', '1', '8', '1', '2026-10-02'); -- id=559
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('559', '1', '8', '0', '559', 'إضافة منتج', 'productController.php', '0', '8', '1', '2026-10-02','0','0'); -- id=3175
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (559, 1,'2026-10-02 18:01:14',1)
                ON DUPLICATE KEY UPDATE productid = 559, edited = 1, sysdate = '2026-10-02 18:01:14', userid = 1; -- id=711
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '120', '120', '2026-10-02', '1', '0', '0', '2026-10-02 18:01:14','إضافة منتج وش شامبين  الكمية 8','1','0','0','0','559','productController.php?do=edit&id=559'); -- id=1207
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1207', '382', '120', '','0'); -- id=1209
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2633767.12', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1207', '121', '120', '','0'); -- id=1208
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1652656.77', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'وش شامبين ', productDescription = '', productCatId = '3', productBuyPrice = '15.00', productSellAllPrice = '19.00', productSellUnitPrice = '19.00', productSellHalfPrice = '19.00', productDate = '2026-10-02', conditions = '0', userId = '1', limitamount = '0', parcode = '00559',type ='0', expireDate = '0' , dailyentryId = '1207',isService = '0',isOptic = '0',lastbuyprice = '15',lastbuyprice_withDiscount = '15',meanbuyprice = '15',meanbuyprice_withDiscount = '15' , productbuypricereal = '15' , buypricereal_precentage = '0' , buytotal_precentage = '26.67' , buyhalf_precentage = '26.67' , buypart_precentage = '26.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='15',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='15',meanbuyprice_withTax='15',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='15',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '559';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:31:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 18:01:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 18:01:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:31:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 18:01:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 18:01:40', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3221

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abfd3f75f12d
-- ----------------------------------------------------------------------------------------------------

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,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 18:01:41', '06abfd3f75f12d', '1', '0.00', '0', '0', '1', '7152.00', '7152', '7152', '0', '1', '2026-10-02 18:01:41', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '32.5' ,'0','','','','','-1','0','0','0','0','0','7152','0','','0','0','7152','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=190
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','190', '0', '2026-10-02 18:01:41', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7152', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 18:01:41','0','0','',''); -- id=325
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00459', '190', '16', '459', '2', '285', '570', '0', '', '1', '2026-10-02 18:01:42', '459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','285','570','0','','0','0.00','0','0','0','0'); -- id=1621
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 1621;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (459, '2026-10-02', 570, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 570, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-02 18:01:42' WHERE storedetailid = '459';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('459', '1', '2', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '7', '1', '2026-10-02 18:01:42','0','0'); -- id=3176
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('285','00558', '190', '16', '558', '3', '325', '975', '0', '', '1', '2026-10-02 18:01:42', '558', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','325','975','0','','0','0.00','0','0','0','0'); -- id=1622
UPDATE sellbilldetail SET  lastbuyprice = 285.00 , meanbuyprice = 285.00, lastbuyprice_withDiscount = 285.00, meanbuyprice_withDiscount = 285.00
        , lastbuyprice_withTax = 285, meanbuyprice_withTax = 285, lastbuyprice_withDiscountAndTax = 285
                where sellbilldetailid = 1622;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (558, '2026-10-02', 975, 855, 855
                    , 855, 855, 855, 855
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 855, 855, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+855
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+855, sellCostMeanBuyPrice = sellCostMeanBuyPrice+855
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+855, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+855
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+855
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+855
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+855
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 975, 855, 855
                    , 855, 855, 855, 855
                    , 0, 0, 0, 0
                    , 0, 0, 0, 855, 855, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+855
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+855, sellCostMeanBuyPrice = sellCostMeanBuyPrice+855
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+855, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+855
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+855
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+855
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+855
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-10-02 18:01:42' WHERE storedetailid = '558';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('558', '1', '3', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '13', '1', '2026-10-02 18:01:42','0','0'); -- id=3177
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1250','00472', '190', '16', '472', '1', '1590', '1590', '0', '', '1', '2026-10-02 18:01:42', '472', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1590','1590','0','','0','0.00','0','0','0','0'); -- id=1623
UPDATE sellbilldetail SET  lastbuyprice = 1250.00 , meanbuyprice = 1250.00, lastbuyprice_withDiscount = 1250.00, meanbuyprice_withDiscount = 1250.00
        , lastbuyprice_withTax = 1250, meanbuyprice_withTax = 1250, lastbuyprice_withDiscountAndTax = 1250
                where sellbilldetailid = 1623;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (472, '2026-10-02', 1590, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1590, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1590, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1590, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 18:01:42' WHERE storedetailid = '472';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('472', '1', '1', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-10-02 18:01:42','0','0'); -- id=3178
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1075','00495', '190', '16', '495', '1', '1375', '1375', '0', '', '1', '2026-10-02 18:01:43', '495', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1375','1375','0','','0','0.00','0','0','0','0'); -- id=1624
UPDATE sellbilldetail SET  lastbuyprice = 1075.00 , meanbuyprice = 1075.00, lastbuyprice_withDiscount = 1075.00, meanbuyprice_withDiscount = 1075.00
        , lastbuyprice_withTax = 1075, meanbuyprice_withTax = 1075, lastbuyprice_withDiscountAndTax = 1075
                where sellbilldetailid = 1624;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (495, '2026-10-02', 1375, 1075, 1075
                    , 1075, 1075, 1075, 1075
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1075, 1075, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1375, sellCostBuyPrice =sellCostBuyPrice+1075
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1075, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1075
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1075, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1075
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1075
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1075
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1075
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1375, 1075, 1075
                    , 1075, 1075, 1075, 1075
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1075, 1075, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1375, sellCostBuyPrice =sellCostBuyPrice+1075
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1075, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1075
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1075, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1075
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1075
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1075
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1075
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 18:01:43' WHERE storedetailid = '495';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('495', '1', '1', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-10-02 18:01:43','0','0'); -- id=3179
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215.25','00143', '190', '21', '143', '3', '218', '654', '0', '', '1', '2026-10-02 18:01:43', '143', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','218','654','0','','0','0.00','0','0','0','0'); -- id=1625
UPDATE sellbilldetail SET  lastbuyprice = 215.25 , meanbuyprice = 215.25, lastbuyprice_withDiscount = 215.25, meanbuyprice_withDiscount = 215.25
        , lastbuyprice_withTax = 215.25, meanbuyprice_withTax = 215.25, lastbuyprice_withDiscountAndTax = 215.25
                where sellbilldetailid = 1625;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (143, '2026-10-02', 654, 645.75, 645.75
                    , 645.75, 645.75, 645.75, 645.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 645.75, 645.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+654, sellCostBuyPrice =sellCostBuyPrice+645.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 654, 645.75, 645.75
                    , 645.75, 645.75, 645.75, 645.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 645.75, 645.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+654, sellCostBuyPrice =sellCostBuyPrice+645.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+645.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+645.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+645.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+645.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+645.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+645.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+645.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-02 18:01:43' WHERE storedetailid = '143';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('143', '1', '3', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '2', '1', '2026-10-02 18:01:43','0','0'); -- id=3180
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','00148', '190', '21', '148', '1', '315', '315', '0', '', '1', '2026-10-02 18:01:43', '148', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','315','315','0','','0','0.00','0','0','0','0'); -- id=1626
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 1626;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (148, '2026-10-02', 315, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+315, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 315, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+315, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-02 18:01:44' WHERE storedetailid = '148';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('148', '1', '1', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '16', '1', '2026-10-02 18:01:44','0','0'); -- id=3181
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 90;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('218','00464', '190', '3', '464', '5', '229.5', '1147.5', '0', '', '1', '2026-10-02 18:01:44', '464', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','90-5,','1','1','0','0','229.5','1147.5','0','','0','0.00','0','0','0','0'); -- id=1627
UPDATE sellbilldetail SET  lastbuyprice = 218.00 , meanbuyprice = 218.00, lastbuyprice_withDiscount = 218.00, meanbuyprice_withDiscount = 218.00
        , lastbuyprice_withTax = 218, meanbuyprice_withTax = 218, lastbuyprice_withDiscountAndTax = 218
                where sellbilldetailid = 1627;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (464, '2026-10-02', 1147.5, 1090, 1090
                    , 1090, 1090, 1090, 1090
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1090, 1090, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1147.5, sellCostBuyPrice =sellCostBuyPrice+1090
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1090, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1090
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1090, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1090
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1090
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1090
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1090
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1147.5, 1090, 1090
                    , 1090, 1090, 1090, 1090
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1090, 1090, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1147.5, sellCostBuyPrice =sellCostBuyPrice+1090
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1090, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1090
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1090, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1090
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1090
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1090
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1090
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-02 18:01:44' WHERE storedetailid = '464';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('464', '1', '5', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '1', '2026-10-02 18:01:44','0','0'); -- id=3182
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 88;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('51.77','00116', '190', '3', '116', '5', '56', '280', '0', '', '1', '2026-10-02 18:01:44', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','88-5,','1','1','0','0','56','280','0','','0','0.00','0','0','0','0'); -- id=1628
UPDATE sellbilldetail SET  lastbuyprice = 51.77 , meanbuyprice = 51.96, lastbuyprice_withDiscount = 51.77, meanbuyprice_withDiscount = 51.96
        , lastbuyprice_withTax = 51.77, meanbuyprice_withTax = 51.96, lastbuyprice_withDiscountAndTax = 51.77
                where sellbilldetailid = 1628;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (116, '2026-10-02', 280, 258.85, 258.85
                    , 259.8, 258.85, 259.8, 258.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 258.85, 259.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+280, sellCostBuyPrice =sellCostBuyPrice+258.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+258.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+259.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+258.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+259.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+258.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+258.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+259.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 280, 258.85, 258.85
                    , 259.8, 258.85, 259.8, 258.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 258.85, 259.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+280, sellCostBuyPrice =sellCostBuyPrice+258.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+258.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+259.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+258.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+259.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+258.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+258.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+259.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2026-10-02 18:01:44' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '5', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59', '54', '1', '2026-10-02 18:01:44','0','0'); -- id=3183
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '190', '14', '80', '.5', '95', '47.5', '0', '', '1', '2026-10-02 18:01:44', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','47.5','0','','0','0.00','0','0','0','0'); -- id=1629
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 1629;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-02', 47.5, 41, 41
                    , 41, 41, 41, 41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.5, 0, 41, 41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 47.5, 41, 41
                    , 41, 41, 41, 41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 41, 41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7.15', userid = '1', storedetaildate = '2026-10-02 18:01:45' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.5', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.65', '7.15', '1', '2026-10-02 18:01:45','0','0'); -- id=3184
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '190', '14', '81', '2', '19', '38', '0', '', '1', '2026-10-02 18:01:45', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=1630
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 1630;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-02', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '218', userid = '1', storedetaildate = '2026-10-02 18:01:45' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '220', '218', '1', '2026-10-02 18:01:45','0','0'); -- id=3185
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.5','00419', '190', '6', '419', '1', '8', '8', '0', '', '1', '2026-10-02 18:01:45', '419', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','8','0','','0','0.00','0','0','0','0'); -- id=1631
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 1631;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-10-02', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-02 18:01:45' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '61', '60', '1', '2026-10-02 18:01:45','0','0'); -- id=3186
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00559', '190', '3', '559', '8', '19', '152', '0', '', '1', '2026-10-02 18:01:45', '559', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','152','0','','0','0.00','0','0','0','0'); -- id=1632
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 1632;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (559, '2026-10-02', 152, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+152, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 152, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+152, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 18:01:46' WHERE storedetailid = '559';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('559', '1', '8', '1', '190', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '0', '1', '2026-10-02 18:01:46','0','0'); -- id=3187
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-489920.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-497072.25','7152', '0', '1', 'اضافة فاتورة مبيعات', '190', '-489920.25', '2026-10-02 18:01:46', '1',  'sellbillController.php','1','','0'); -- id=186
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7152', '7152', '2026-10-02', '1', '0', '0', '2026-10-02 18:01:46','اضافة فاتورة مبيعات رقم 190','1','0',null,'0','190','sellbillController.php?do=showDetail&sellbillid=190'); -- id=1208
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1208', '383', '7152', '','0'); -- id=1210
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-323788.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1208', '143', '7152', '','0'); -- id=1209
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '728756.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6192.1', '6192.1', '2026-10-02', '1', '0', '0', '2026-10-02 18:01:46','اضافة فاتورة مبيعات رقم 190 - صرف البضاعة من المخزن','1','0',null,'0','190','sellbillController.php?do=showDetail&sellbillid=190'); -- id=1209
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1209', '402', '6192.1', '','0'); -- id=1211
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '664678.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1209', '382', '6192.1', '','0'); -- id=1210
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2627575.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1208,0,1209' where sellbillid=190;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 7152, 6192.1, 6192.1
                    , 6193.05, 6192.1, 6193.05, 6192.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6192.1, 6193.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7152, sellCostBuyPrice =sellCostBuyPrice+6192.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6192.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6193.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6192.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6193.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6192.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6192.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6193.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 7152, 6192.1, 6192.1
                    , 6193.05, 6192.1, 6193.05, 6192.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6192.1, 6193.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7152, sellCostBuyPrice =sellCostBuyPrice+6192.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6192.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6193.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6192.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6193.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6192.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6192.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6193.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 7152, 6192.1, 6192.1
                    , 6193.05, 6192.1, 6193.05, 6192.1, 6192.1, 6193.05)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7152, netSellCostBuyPrice = netSellCostBuyPrice+6192.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6192.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6193.05
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6192.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6193.05
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6192.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6192.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6193.05;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abfd3f75f12d and sellbillId = 190 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 14:31:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 18:01:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 18:01:48', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:39:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:09:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:09:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3223
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:41:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:11:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:11:18', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3224

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abff369c41b3
-- ----------------------------------------------------------------------------------------------------

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,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 20:11:19', '06abff369c41b3', '1', '0.00', '0', '0', '1', '5005.00', '5005', '5005', '0', '1', '2026-10-02 20:11:19', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','5005','0','','0','0','5005','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=191
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','191', '0', '2026-10-02 20:11:19', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5005', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 20:11:19','0','0','',''); -- id=326
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00513', '191', '16', '513', '2', '290', '580', '0', '', '1', '2026-10-02 20:11:20', '513', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','290','580','0','','0','0.00','0','0','0','0'); -- id=1633
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1633;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (513, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 20:11:20' WHERE storedetailid = '513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '1', '2', '1', '191', 'اضافة فاتورة مبيعات', 'sellbillController.php', '22', '20', '1', '2026-10-02 20:11:20','0','0'); -- id=3188
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('220','00460', '191', '16', '460', '2', '235', '470', '0', '', '1', '2026-10-02 20:11:20', '460', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','235','470','0','','0','0.00','0','0','0','0'); -- id=1634
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
        , lastbuyprice_withTax = 220, meanbuyprice_withTax = 220, lastbuyprice_withDiscountAndTax = 220
                where sellbilldetailid = 1634;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (460, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 20:11:20' WHERE storedetailid = '460';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('460', '1', '2', '1', '191', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '1', '1', '2026-10-02 20:11:20','0','0'); -- id=3189
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('790','00466', '191', '16', '466', '1', '925', '925', '0', '', '1', '2026-10-02 20:11:20', '466', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','925','925','0','','0','0.00','0','0','0','0'); -- id=1635
UPDATE sellbilldetail SET  lastbuyprice = 790.00 , meanbuyprice = 790.00, lastbuyprice_withDiscount = 790.00, meanbuyprice_withDiscount = 790.00
        , lastbuyprice_withTax = 790, meanbuyprice_withTax = 790, lastbuyprice_withDiscountAndTax = 790
                where sellbilldetailid = 1635;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (466, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-02 20:11:21' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '1', '1', '191', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-10-02 20:11:21','0','0'); -- id=3190
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 33;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1750','00426', '191', '16', '426', '1', '1980', '1980', '0', '', '1', '2026-10-02 20:11:21', '426', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','33-1,','1','1','0','0','1980','1980','0','','0','0.00','0','0','0','0'); -- id=1636
UPDATE sellbilldetail SET  lastbuyprice = 1750.00 , meanbuyprice = 1750.00, lastbuyprice_withDiscount = 1750.00, meanbuyprice_withDiscount = 1750.00
        , lastbuyprice_withTax = 1750, meanbuyprice_withTax = 1750, lastbuyprice_withDiscountAndTax = 1750
                where sellbilldetailid = 1636;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (426, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 20:11:21' WHERE storedetailid = '426';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '1', '1', '1', '191', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-02 20:11:21','0','0'); -- id=3191
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('850','00506', '191', '16', '506', '1', '1050', '1050', '0', '', '1', '2026-10-02 20:11:21', '506', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1050','1050','0','','0','0.00','0','0','0','0'); -- id=1637
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 1637;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (506, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-02 20:11:21' WHERE storedetailid = '506';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('506', '1', '1', '1', '191', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-10-02 20:11:21','0','0'); -- id=3192
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-484915.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-489920.25','5005', '0', '1', 'اضافة فاتورة مبيعات', '191', '-484915.25', '2026-10-02 20:11:21', '1',  'sellbillController.php','1','','0'); -- id=187
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5005', '5005', '2026-10-02', '1', '0', '0', '2026-10-02 20:11:22','اضافة فاتورة مبيعات رقم 191','1','0',null,'0','191','sellbillController.php?do=showDetail&sellbillid=191'); -- id=1210
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1210', '383', '5005', '','0'); -- id=1212
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-318783.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1210', '143', '5005', '','0'); -- id=1211
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '733761.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4380', '4380', '2026-10-02', '1', '0', '0', '2026-10-02 20:11:22','اضافة فاتورة مبيعات رقم 191 - صرف البضاعة من المخزن','1','0',null,'0','191','sellbillController.php?do=showDetail&sellbillid=191'); -- id=1211
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1211', '402', '4380', '','0'); -- id=1213
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '669058.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1211', '382', '4380', '','0'); -- id=1212
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2623195.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1210,0,1211' where sellbillid=191;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4380, 4380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5005, sellCostBuyPrice =sellCostBuyPrice+4380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4380, 4380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5005, sellCostBuyPrice =sellCostBuyPrice+4380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380, 4380, 4380)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5005, netSellCostBuyPrice = netSellCostBuyPrice+4380
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4380
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4380
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4380
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4380
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4380
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4380
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4380;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abff369c41b3 and sellbillId = 191 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:41:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:11:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:11:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3225
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:43:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:13:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:13:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3226
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:44:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:14:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:14:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3227
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:44:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:14:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:14:18', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=191'); -- id=3228
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:45:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:15:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:15:04', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3229
BEGIN;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - with id = 191 and  = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete start with id = 191 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 191;
UPDATE sellbill SET  sellbillsysdate = '2026-10-02 20:15:05', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '191';
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1633;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (513, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-580, sellCostBuyPrice =sellCostBuyPrice-550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-550, sellCostMeanBuyPrice = sellCostMeanBuyPrice-550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-550
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-580, sellCostBuyPrice =sellCostBuyPrice-550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-550, sellCostMeanBuyPrice = sellCostMeanBuyPrice-550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-550
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2026-10-02 20:15:05' WHERE storedetailid = '513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '1', '2', '0', '191', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '22', '1', '2026-10-02 20:11:19','0','0'); -- id=3193
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
        , lastbuyprice_withTax = 220, meanbuyprice_withTax = 220, lastbuyprice_withDiscountAndTax = 220
                where sellbilldetailid = 1634;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (460, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-470, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-470, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 20:15:05' WHERE storedetailid = '460';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('460', '1', '2', '0', '191', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '3', '1', '2026-10-02 20:11:19','0','0'); -- id=3194
UPDATE sellbilldetail SET  lastbuyprice = 790.00 , meanbuyprice = 790.00, lastbuyprice_withDiscount = 790.00, meanbuyprice_withDiscount = 790.00
        , lastbuyprice_withTax = 790, meanbuyprice_withTax = 790, lastbuyprice_withDiscountAndTax = 790
                where sellbilldetailid = 1635;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (466, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-790, sellCostMeanBuyPrice = sellCostMeanBuyPrice-790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-790
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-790, sellCostMeanBuyPrice = sellCostMeanBuyPrice-790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-790
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 20:15:05' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '1', '0', '191', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-10-02 20:11:19','0','0'); -- id=3195
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 33;
UPDATE sellbilldetail SET  lastbuyprice = 1750.00 , meanbuyprice = 1750.00, lastbuyprice_withDiscount = 1750.00, meanbuyprice_withDiscount = 1750.00
        , lastbuyprice_withTax = 1750, meanbuyprice_withTax = 1750, lastbuyprice_withDiscountAndTax = 1750
                where sellbilldetailid = 1636;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (426, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1980, sellCostBuyPrice =sellCostBuyPrice-1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1750
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1980, sellCostBuyPrice =sellCostBuyPrice-1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1750
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 20:15:05' WHERE storedetailid = '426';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '1', '1', '0', '191', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-10-02 20:11:19','0','0'); -- id=3196
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 1637;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (506, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-02 20:15:05' WHERE storedetailid = '506';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('506', '1', '1', '0', '191', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-10-02 20:11:19','0','0'); -- id=3197
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','191', '0', '2026-10-02 20:11:19', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '5005', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 20:11:19','0','0','',''); -- id=327
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-489920.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-484915.25','5005', '1', '1', 'تعديل فاتورة مبيعات', '191', '-489920.25', '2026-10-02 20:15:05', '1',  'sellbillController.php','1','','0'); -- id=188
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4380, 4380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5005, sellCostBuyPrice =sellCostBuyPrice-4380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4380, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4380
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4380, 4380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5005, sellCostBuyPrice =sellCostBuyPrice-4380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4380, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4380
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5005, 4380, 4380
                    , 4380, 4380, 4380, 4380, 4380, 4380)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-5005, netSellCostBuyPrice = netSellCostBuyPrice-4380
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-4380
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-4380
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-4380
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-4380
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-4380
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-4380
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-4380;

-- ----------------------------------------------------------------------------------------------------
-- bill update start - delete end - with id = 191 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 191 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

COMMIT;
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,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 20:11:19', '06abff369c41b3', '1', '0.00', '0', '0', '1', '5575', '5575', '5575', '0', '1', '2026-10-02 20:11:19', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '10', '191', 'sellbillController', '0','','','','','-1','0','0','5575','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=192
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات (معدله)','192', '0', '2026-10-02 20:15:06', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '5575', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 20:11:19','0','0','',''); -- id=328
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00513', '192', '16', '513', '2.00', '290', '580', '0', '', '1', '2026-10-02 20:15:06', '513', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','290','580','0','','0','0.00','0','0','0','0'); -- id=1638
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1638;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (513, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 580, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-02 20:15:07' WHERE storedetailid = '513';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '1', '2', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '22', '20', '1', '2026-10-02 20:15:07','0','0'); -- id=3198
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('220','00460', '192', '16', '460', '2.00', '235', '470', '0', '', '1', '2026-10-02 20:15:07', '460', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','235','470','0','','0','0.00','0','0','0','0'); -- id=1639
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
        , lastbuyprice_withTax = 220, meanbuyprice_withTax = 220, lastbuyprice_withDiscountAndTax = 220
                where sellbilldetailid = 1639;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (460, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 470, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-02 20:15:07' WHERE storedetailid = '460';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('460', '1', '2', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '1', '1', '2026-10-02 20:15:07','0','0'); -- id=3199
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('790','00466', '192', '16', '466', '1.00', '925', '925', '0', '', '1', '2026-10-02 20:15:07', '466', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','925','925','0','','0','0.00','0','0','0','0'); -- id=1640
UPDATE sellbilldetail SET  lastbuyprice = 790.00 , meanbuyprice = 790.00, lastbuyprice_withDiscount = 790.00, meanbuyprice_withDiscount = 790.00
        , lastbuyprice_withTax = 790, meanbuyprice_withTax = 790, lastbuyprice_withDiscountAndTax = 790
                where sellbilldetailid = 1640;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (466, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 925, 790, 790
                    , 790, 790, 790, 790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 790, 790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-02 20:15:07' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '1', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-10-02 20:15:07','0','0'); -- id=3200
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 33;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1750','00426', '192', '16', '426', '1.00', '1980', '1980', '0', '', '1', '2026-10-02 20:15:07', '426', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','33-1,','1','1','0','0','1980','1980','0','','0','0.00','0','0','0','0'); -- id=1641
UPDATE sellbilldetail SET  lastbuyprice = 1750.00 , meanbuyprice = 1750.00, lastbuyprice_withDiscount = 1750.00, meanbuyprice_withDiscount = 1750.00
        , lastbuyprice_withTax = 1750, meanbuyprice_withTax = 1750, lastbuyprice_withDiscountAndTax = 1750
                where sellbilldetailid = 1641;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (426, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1980, 1750, 1750
                    , 1750, 1750, 1750, 1750
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1750, 1750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-02 20:15:08' WHERE storedetailid = '426';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '1', '1', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-10-02 20:15:08','0','0'); -- id=3201
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('850','00506', '192', '16', '506', '1.00', '1050', '1050', '0', '', '1', '2026-10-02 20:15:08', '506', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1050','1050','0','','0','0.00','0','0','0','0'); -- id=1642
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 1642;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (506, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-02 20:15:08' WHERE storedetailid = '506';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('506', '1', '1', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-10-02 20:15:08','0','0'); -- id=3202
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 74;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('165','00161', '192', '22', '161', '3', '190', '570', '0', '', '1', '2026-10-02 20:15:08', '161', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','74-3,','1','1','0','0','190','570','0','','0','0.00','0','0','0','0'); -- id=1643
UPDATE sellbilldetail SET  lastbuyprice = 165.00 , meanbuyprice = 165.00, lastbuyprice_withDiscount = 165.00, meanbuyprice_withDiscount = 165.00
        , lastbuyprice_withTax = 165, meanbuyprice_withTax = 165, lastbuyprice_withDiscountAndTax = 165
                where sellbilldetailid = 1643;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (161, '2026-10-02', 570, 495, 495
                    , 495, 495, 495, 495
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 495, 495, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+495, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+495
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+495
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+495
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+495
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 570, 495, 495
                    , 495, 495, 495, 495
                    , 0, 0, 0, 0
                    , 0, 0, 0, 495, 495, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+495
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+495, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+495
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+495
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+495
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+495
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2026-10-02 20:15:08' WHERE storedetailid = '161';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('161', '1', '3', '1', '192', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '77', '74', '1', '2026-10-02 20:15:08','0','0'); -- id=3203
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-484345.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-489920.25','5575', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '192', '-484345.25', '2026-10-02 20:15:08', '1',  'sellbillController.php','1','','0'); -- id=189
UPDATE dailyentry SET totalcreditor = '5005.00', totaldebtor = '5005.00', thedate = '2026-10-02', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-02 20:11:22', entryComment = 'اضافة فاتورة مبيعات رقم 191', fromFlag = '1',related='0',isopeningentry='0',operationId='191',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=191' WHERE id = '1210';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5005.00', '5005.00', '2026-10-02', '1', '0', '1210', '2026-10-02 20:15:09','تم عكس القيد رقم 1210 ','1','0','0','0','0',''); -- id=1212
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1212', '383', '5005.00', '','0'); -- id=1213
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-323788.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1212', '143', '5005.00', '','0'); -- id=1214
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '728756.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '4380.00', totaldebtor = '4380.00', thedate = '2026-10-02', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-02 20:11:22', entryComment = 'اضافة فاتورة مبيعات رقم 191 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='191',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=191' WHERE id = '1211';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4380.00', '4380.00', '2026-10-02', '1', '0', '1211', '2026-10-02 20:15:09','تم عكس القيد رقم 1211 ','1','0','0','0','0',''); -- id=1213
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1213', '402', '4380.00', '','0'); -- id=1214
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '664678.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1213', '382', '4380.00', '','0'); -- id=1215
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2627575.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5575', '5575', '2026-10-02', '1', '0', '0', '2026-10-02 20:15:10','اضافة فاتورة مبيعات رقم 192','1','0',null,'0','192','sellbillController.php?do=showDetail&sellbillid=192'); -- id=1214
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1214', '383', '5575', '','0'); -- id=1216
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-318213.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1214', '143', '5575', '','0'); -- id=1215
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '734331.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4875', '4875', '2026-10-02', '1', '0', '0', '2026-10-02 20:15:10','اضافة فاتورة مبيعات رقم 192 - صرف البضاعة من المخزن','1','0',null,'0','192','sellbillController.php?do=showDetail&sellbillid=192'); -- id=1215
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1215', '402', '4875', '','0'); -- id=1217
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '669553.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1215', '382', '4875', '','0'); -- id=1216
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2622700.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1214,0,1215' where sellbillid=192;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 5575, 4875, 4875
                    , 4875, 4875, 4875, 4875
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4875, 4875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5575, sellCostBuyPrice =sellCostBuyPrice+4875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 5575, 4875, 4875
                    , 4875, 4875, 4875, 4875
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4875, 4875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5575, sellCostBuyPrice =sellCostBuyPrice+4875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4875
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5575, 4875, 4875
                    , 4875, 4875, 4875, 4875, 4875, 4875)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5575, netSellCostBuyPrice = netSellCostBuyPrice+4875
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4875
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4875
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4875
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4875
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4875
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4875
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4875;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 191 and newid=192 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:45:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:15:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:15:11', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=192'); -- id=3230
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:48:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:18:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:18:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3231
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:50:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:20:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:20:15', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3232

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abff5927c483
-- ----------------------------------------------------------------------------------------------------

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,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 20:20:15', '06abff5927c483', '1', '0.00', '0', '0', '1', '270.00', '270', '270', '0', '1', '2026-10-02 20:20:15', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','270','0','','0','0','270','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=193
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','193', '0', '2026-10-02 20:20:16', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '270', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 20:20:15','0','0','',''); -- id=329
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 74;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('165','00161', '193', '22', '161', '1', '190', '190', '0', '', '1', '2026-10-02 20:20:16', '161', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','74-1,','1','1','0','0','190','190','0','','0','0.00','0','0','0','0'); -- id=1644
UPDATE sellbilldetail SET  lastbuyprice = 165.00 , meanbuyprice = 165.00, lastbuyprice_withDiscount = 165.00, meanbuyprice_withDiscount = 165.00
        , lastbuyprice_withTax = 165, meanbuyprice_withTax = 165, lastbuyprice_withDiscountAndTax = 165
                where sellbilldetailid = 1644;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (161, '2026-10-02', 190, 165, 165
                    , 165, 165, 165, 165
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 165, 165, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+165
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+165, sellCostMeanBuyPrice = sellCostMeanBuyPrice+165
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+165, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+165
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+165
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+165
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+165
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 190, 165, 165
                    , 165, 165, 165, 165
                    , 0, 0, 0, 0
                    , 0, 0, 0, 165, 165, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+165
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+165, sellCostMeanBuyPrice = sellCostMeanBuyPrice+165
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+165, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+165
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+165
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+165
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+165
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '73', userid = '1', storedetaildate = '2026-10-02 20:20:16' WHERE storedetailid = '161';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('161', '1', '1', '1', '193', 'اضافة فاتورة مبيعات', 'sellbillController.php', '74', '73', '1', '2026-10-02 20:20:16','0','0'); -- id=3204
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 28;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('64','00170', '193', '2', '170', '1', '80', '80', '0', '', '1', '2026-10-02 20:20:16', '170', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','28-1,','1','1','0','0','80','80','0','','0','0.00','0','0','0','0'); -- id=1645
UPDATE sellbilldetail SET  lastbuyprice = 64.00 , meanbuyprice = 64.00, lastbuyprice_withDiscount = 64.00, meanbuyprice_withDiscount = 64.00
        , lastbuyprice_withTax = 64, meanbuyprice_withTax = 64, lastbuyprice_withDiscountAndTax = 64
                where sellbilldetailid = 1645;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (170, '2026-10-02', 80, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+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,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 80, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '126', userid = '1', storedetaildate = '2026-10-02 20:20:17' WHERE storedetailid = '170';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('170', '1', '1', '1', '193', 'اضافة فاتورة مبيعات', 'sellbillController.php', '127', '126', '1', '2026-10-02 20:20:17','0','0'); -- id=3205
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-484075.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-484345.25','270', '0', '1', 'اضافة فاتورة مبيعات', '193', '-484075.25', '2026-10-02 20:20:17', '1',  'sellbillController.php','1','','0'); -- id=190
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '270', '270', '2026-10-02', '1', '0', '0', '2026-10-02 20:20:17','اضافة فاتورة مبيعات رقم 193','1','0',null,'0','193','sellbillController.php?do=showDetail&sellbillid=193'); -- id=1216
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1216', '383', '270', '','0'); -- id=1218
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-317943.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1216', '143', '270', '','0'); -- id=1217
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '734601.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '229', '229', '2026-10-02', '1', '0', '0', '2026-10-02 20:20:17','اضافة فاتورة مبيعات رقم 193 - صرف البضاعة من المخزن','1','0',null,'0','193','sellbillController.php?do=showDetail&sellbillid=193'); -- id=1217
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1217', '402', '229', '','0'); -- id=1219
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '669782.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1217', '382', '229', '','0'); -- id=1218
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2622471.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1216,0,1217' where sellbillid=193;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 270, 229, 229
                    , 229, 229, 229, 229
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,229, 229, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+229
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+229, sellCostMeanBuyPrice = sellCostMeanBuyPrice+229
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+229, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+229
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+229
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+229
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+229
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 270, 229, 229
                    , 229, 229, 229, 229
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,229, 229, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+229
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+229, sellCostMeanBuyPrice = sellCostMeanBuyPrice+229
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+229, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+229
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+229
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+229
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+229
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 270, 229, 229
                    , 229, 229, 229, 229, 229, 229)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+270, netSellCostBuyPrice = netSellCostBuyPrice+229
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+229
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+229
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+229
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+229
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+229
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+229
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+229;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abff5927c483 and sellbillId = 193 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:50:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:20:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:20:18', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3233
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:54:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:24:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:24:13', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3234

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abfd56cb107d
-- ----------------------------------------------------------------------------------------------------

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,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 20:24:13', '06abfd56cb107d', '1', '0.00', '0', '0', '1', '13075.00', '13075', '13075', '0', '1', '2026-10-02 20:24:13', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '90' ,'0','','','','','-1','0','0','0','0','0','13075','0','','0','0','13075','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=194
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','194', '0', '2026-10-02 20:24:14', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13075', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 20:24:13','0','0','',''); -- id=330
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 108;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','00197', '194', '20', '197', '35', '227', '7945', '0', '', '1', '2026-10-02 20:24:14', '197', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','108-3,','1','1','0','0','227','7945','0','','0','0.00','0','0','0','0'); -- id=1646
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 211.46, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 211.46
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 211.46, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 1646;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (197, '2026-10-02', 7945, 9100, 9100
                    , 7401.1, 9100, 7401.1, 9100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 0, 9100, 7401.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7945, sellCostBuyPrice =sellCostBuyPrice+9100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7401.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7401.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7401.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+35
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 7945, 9100, 9100
                    , 7401.1, 9100, 7401.1, 9100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9100, 7401.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7945, sellCostBuyPrice =sellCostBuyPrice+9100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7401.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7401.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7401.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2026-10-02 20:24:14' WHERE storedetailid = '197';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('197', '1', '35', '1', '194', 'اضافة فاتورة مبيعات', 'sellbillController.php', '103', '68', '1', '2026-10-02 20:24:14','0','0'); -- id=3206
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('330','00200', '194', '20', '200', '15', '330', '4950', '0', '', '1', '2026-10-02 20:24:14', '200', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','330','4950','0','','0','0.00','0','0','0','0'); -- id=1647
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 330, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 1647;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (200, '2026-10-02', 4950, 4950, 4950
                    , 4950, 4950, 4950, 4950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4950, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 4950, 4950, 4950
                    , 4950, 4950, 4950, 4950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4950, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-02 20:24:15' WHERE storedetailid = '200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('200', '1', '15', '1', '194', 'اضافة فاتورة مبيعات', 'sellbillController.php', '22', '7', '1', '2026-10-02 20:24:15','0','0'); -- id=3207
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00392', '194', '7', '392', '20', '5', '100', '0', '', '1', '2026-10-02 20:24:15', '392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5','100','0','','0','0.00','0','0','0','0'); -- id=1648
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 1648;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (392, '2026-10-02', 100, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 100, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '83', userid = '1', storedetaildate = '2026-10-02 20:24:15' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '20', '1', '194', 'اضافة فاتورة مبيعات', 'sellbillController.php', '103', '83', '1', '2026-10-02 20:24:15','0','0'); -- id=3208
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4','00393', '194', '7', '393', '20', '4', '80', '0', '', '1', '2026-10-02 20:24:15', '393', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4','80','0','','0','0.00','0','0','0','0'); -- id=1649
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.00, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.00
        , lastbuyprice_withTax = 4, meanbuyprice_withTax = 4, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 1649;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (393, '2026-10-02', 80, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 80, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '275', userid = '1', storedetaildate = '2026-10-02 20:24:15' WHERE storedetailid = '393';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('393', '1', '20', '1', '194', 'اضافة فاتورة مبيعات', 'sellbillController.php', '295', '275', '1', '2026-10-02 20:24:15','0','0'); -- id=3209
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-471000.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-484075.25','13075', '0', '1', 'اضافة فاتورة مبيعات', '194', '-471000.25', '2026-10-02 20:24:15', '1',  'sellbillController.php','1','','0'); -- id=191
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13075', '13075', '2026-10-02', '1', '0', '0', '2026-10-02 20:24:16','اضافة فاتورة مبيعات رقم 194','1','0',null,'0','194','sellbillController.php?do=showDetail&sellbillid=194'); -- id=1218
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1218', '383', '13075', '','0'); -- id=1220
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-304868.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1218', '143', '13075', '','0'); -- id=1219
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '747676.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14220', '14220', '2026-10-02', '1', '0', '0', '2026-10-02 20:24:16','اضافة فاتورة مبيعات رقم 194 - صرف البضاعة من المخزن','1','0',null,'0','194','sellbillController.php?do=showDetail&sellbillid=194'); -- id=1219
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1219', '402', '14220', '','0'); -- id=1221
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '684002.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1219', '382', '14220', '','0'); -- id=1220
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2608251.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1218,0,1219' where sellbillid=194;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 13075, 14220, 14220
                    , 12521.1, 14220, 12521.1, 14220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14220, 12521.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13075, sellCostBuyPrice =sellCostBuyPrice+14220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12521.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12521.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12521.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 13075, 14220, 14220
                    , 12521.1, 14220, 12521.1, 14220
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14220, 12521.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13075, sellCostBuyPrice =sellCostBuyPrice+14220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12521.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12521.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12521.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 13075, 14220, 14220
                    , 12521.1, 14220, 12521.1, 14220, 14220, 12521.1)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13075, netSellCostBuyPrice = netSellCostBuyPrice+14220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12521.1
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12521.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14220
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12521.1;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abfd56cb107d and sellbillId = 194 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 16:54:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 20:24:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 20:24:17', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3235
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-02 21:34:03', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=3236
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-02 21:34:04', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=3237
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-02 21:34:08', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=3238
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-02 21:34:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3239
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-02 21:34:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3240
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:34:35', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=154'); -- id=3241
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:04:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:34:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-10-02 21:34:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientController.php?do=show'); -- id=3242
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:06:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:36:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-02 21:36:49', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php'); -- id=3243
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:06:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:36:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-02 21:36:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=3244
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:08:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:38:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-02 21:38:29', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=3245
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:08:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:38:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-02 21:38:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=3246
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:09:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:39:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-02 21:39:14', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellBillReportsController.php'); -- id=3247
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:09:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:39:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:39:20', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=192'); -- id=3248
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:09:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:39:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-02 21:39:34', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=3249
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:09:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:39:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-02 21:39:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=3250
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:10:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:40:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:40:49', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3251
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:11:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:41:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:41:29', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3252

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac008c27994f
-- ----------------------------------------------------------------------------------------------------

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,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-02 21:41:29', '06ac008c27994f', '1', '0.00', '0', '0', '1', '2325.00', '2325', '2325', '0', '1', '2026-10-02 21:41:29', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','2325','0','','0','0','2325','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-02','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=195
UPDATE client SET  clientdebt = '0', userid = '1' 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,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','195', '0', '2026-10-02 21:41:30', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2325', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-02 21:41:29','0','0','',''); -- id=331
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 52;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('168','00452', '195', '6', '452', '5', '215', '1075', '0', '', '1', '2026-10-02 21:41:30', '452', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','52-5,','1','1','0','0','215','1075','0','','0','0.00','0','0','0','0'); -- id=1650
UPDATE sellbilldetail SET  lastbuyprice = 168.00 , meanbuyprice = 168.00, lastbuyprice_withDiscount = 168.00, meanbuyprice_withDiscount = 168.00
        , lastbuyprice_withTax = 168, meanbuyprice_withTax = 168, lastbuyprice_withDiscountAndTax = 168
                where sellbilldetailid = 1650;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (452, '2026-10-02', 1075, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1075, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1075, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1075, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-10-02 21:41:30' WHERE storedetailid = '452';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('452', '1', '5', '1', '195', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '39', '1', '2026-10-02 21:41:30','0','0'); -- id=3210
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 53;
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,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('212','00453', '195', '6', '453', '5', '250', '1250', '0', '', '1', '2026-10-02 21:41:30', '453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','53-5,','1','1','0','0','250','1250','0','','0','0.00','0','0','0','0'); -- id=1651
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 1651;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-02', 1250, 1060, 1060
                    , 1060, 1060, 1060, 1060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1060, 1060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1250, sellCostBuyPrice =sellCostBuyPrice+1060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 1250, 1060, 1060
                    , 1060, 1060, 1060, 1060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1060, 1060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1250, sellCostBuyPrice =sellCostBuyPrice+1060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-10-02 21:41:31' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '5', '1', '195', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '39', '1', '2026-10-02 21:41:31','0','0'); -- id=3211
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-468675.25',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-471000.25','2325', '0', '1', 'اضافة فاتورة مبيعات', '195', '-468675.25', '2026-10-02 21:41:31', '1',  'sellbillController.php','1','','0'); -- id=192
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2325', '2325', '2026-10-02', '1', '0', '0', '2026-10-02 21:41:31','اضافة فاتورة مبيعات رقم 195','1','0',null,'0','195','sellbillController.php?do=showDetail&sellbillid=195'); -- id=1220
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1220', '383', '2325', '','0'); -- id=1222
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-302543.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1220', '143', '2325', '','0'); -- id=1221
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '750001.52', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1900', '1900', '2026-10-02', '1', '0', '0', '2026-10-02 21:41:31','اضافة فاتورة مبيعات رقم 195 - صرف البضاعة من المخزن','1','0',null,'0','195','sellbillController.php?do=showDetail&sellbillid=195'); -- id=1221
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1221', '402', '1900', '','0'); -- id=1223
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '685902.57', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1221', '382', '1900', '','0'); -- id=1222
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2606351.02', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1220,0,1221' where sellbillid=195;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-02', 2325, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2325, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-02', 2325, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2325, sellCostBuyPrice =sellCostBuyPrice+1900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2325, 1900, 1900
                    , 1900, 1900, 1900, 1900, 1900, 1900)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2325, netSellCostBuyPrice = netSellCostBuyPrice+1900
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1900
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1900
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1900
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1900
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1900
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1900
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1900;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac008c27994f and sellbillId = 195 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:11:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:41:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:41:32', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3253
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:11:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:41:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-02 21:41:39', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=3254
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:11:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:41:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 21:41:53', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3255
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:13:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:43:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('invoicesearningsreportController.php', '2026-10-02 21:43:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/invoicesearningsreportController.php'); -- id=3256
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:14:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:44:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:44:06', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=194'); -- id=3257
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:16:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:46:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 21:46:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3258
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:16:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:46:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 21:46:22', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3259
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:16:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:46:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-02 21:46:32', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3260
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:22:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:52:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 21:52:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3261
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-02 21:53:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3262
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:53:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=3263
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:53:52', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=3264
BEGIN;
CALL supplierInUse(9,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('9', '175188.60', '10000', '1', 'ايصال دفع لمورد', '1', '165188.6', '2026-10-02 21:53:38', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','10000','1','0','0','0','17',''); -- id=67
UPDATE supplierdebtchange SET supplierid = '9', supplierdebtchangebefore = '175188.60', supplierdebtchangeamount = '10000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '165188.6', supplierdebtchangedate = '2026-10-02 21:53:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='175188.6',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='165188.6', paySerialNo='17',tagids='' WHERE supplierdebtchangeid = '67';
UPDATE supplier SET  suppliercurrentDebt = '165188.6',suppliercurrentDebtInCurrency= '165188.6' , userid = '1', supplierdate = '2026-10-02 21:53:52'   WHERE supplierid = '9';
UPDATE supplier SET  inUse = 0 where supplierid = 9;
UPDATE save SET  savecurrentvalue = '-478675.25',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-468675.25','10000', '1', '1', 'ايصال دفع لمورد', '67', '-478675.25', '2026-10-02 21:53:52', '1',  'supplierPayedDeptController.php','0','','0'); -- id=193
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-10-02', '1', '0', '0', '2026-10-02 21:53:52','ايصال دفع لمورد ( شركه باندا حساب نشات  ) ','1','0','0','0','67','supplierReportsController.php?do=show&id=67'); -- id=1222
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1222', '432', '10000', '','0'); -- id=1224
UPDATE accountstree SET name = 'شركه باندا حساب نشات ', customName = 'شركه باندا حساب نشات ', customNameEn = 'شركه باندا حساب نشات ', nameEn = 'شركه باندا حساب نشات ', parent = '81', accountNature = '1', theValue = '165188.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 22:21:02' WHERE id = '432';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1222', '383', '10000', '','0'); -- id=1223
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-312543.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '9', supplierdebtchangebefore = '175188.60', supplierdebtchangeamount = '10000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '165188.60', supplierdebtchangedate = '2026-10-02 21:53:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1222',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='175188.6',debtchangamountInSupplierCurrency='10000',debtchangafterInSupplierCurrency='165188.6', paySerialNo='17',tagids='' WHERE supplierdebtchangeid = '67';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:53:53', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=3265
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:53:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=3266
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:23:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:53:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-02 21:53:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=3267
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:24:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:54:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:54:19', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=3268
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:24:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:54:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:54:31', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=3269
BEGIN;
CALL supplierInUse(10,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('10', '28940.00', '5000', '1', 'ايصال دفع لمورد', '1', '23940', '2026-10-02 21:54:19', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','5000','1','0','0','0','18',''); -- id=68
UPDATE supplierdebtchange SET supplierid = '10', supplierdebtchangebefore = '28940.00', supplierdebtchangeamount = '5000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '23940', supplierdebtchangedate = '2026-10-02 21:54:19', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='5000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='28940',debtchangamountInSupplierCurrency='5000',debtchangafterInSupplierCurrency='23940', paySerialNo='18',tagids='' WHERE supplierdebtchangeid = '68';
UPDATE supplier SET  suppliercurrentDebt = '23940',suppliercurrentDebtInCurrency= '23940' , userid = '1', supplierdate = '2026-10-02 21:54:32'   WHERE supplierid = '10';
UPDATE supplier SET  inUse = 0 where supplierid = 10;
UPDATE save SET  savecurrentvalue = '-483675.25',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-478675.25','5000', '1', '1', 'ايصال دفع لمورد', '68', '-483675.25', '2026-10-02 21:54:32', '1',  'supplierPayedDeptController.php','0','','0'); -- id=194
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5000', '5000', '2026-10-02', '1', '0', '0', '2026-10-02 21:54:32','ايصال دفع لمورد ( شركه باندا حساب محمد ) ','1','0','0','0','68','supplierReportsController.php?do=show&id=68'); -- id=1223
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1223', '433', '5000', '','0'); -- id=1225
UPDATE accountstree SET name = 'شركه باندا حساب محمد', customName = 'شركه باندا حساب محمد', customNameEn = 'شركه باندا حساب محمد', nameEn = 'شركه باندا حساب محمد', parent = '81', accountNature = '1', theValue = '23940', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 22:21:33' WHERE id = '433';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1223', '383', '5000', '','0'); -- id=1224
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-317543.72', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '10', supplierdebtchangebefore = '28940.00', supplierdebtchangeamount = '5000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '23940.00', supplierdebtchangedate = '2026-10-02 21:54:19', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1223',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='5000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='28940',debtchangamountInSupplierCurrency='5000',debtchangafterInSupplierCurrency='23940', paySerialNo='18',tagids='' WHERE supplierdebtchangeid = '68';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:24:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:54:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:54:33', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=3270
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:24:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:54:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-02 21:54:35', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=3271
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-02 18:24:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-02 21:54:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-02 21:54:36', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=3272
