UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 05:59:08";
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-04 05:59:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:29:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-04 09:29:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=3360
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-04',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-04 05:59:33";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-04 09:29:33', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=3361
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 05:59:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:29:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-04 09:29:52', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=3362
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 05:59:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:29:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-04 09:29:53', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=3363
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 06:00:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:30:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-10-04 09:30:06', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=3364
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 06:00:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:30:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 09:30:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3365
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 06:00:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:30:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 09:30:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3366
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 06:01:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:31:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 09:31:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3367
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 06:01:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 09:31:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 09:31:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3368
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 10:57:52";
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-04 10:57:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:27:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-04 14:27:57', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=3369
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-04 10:58:02";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-04 14:28:02', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=3370
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 10:58:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:28:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:28:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3371
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:00:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:30:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:30:46', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3372

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac2466b15337
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(7,@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,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-04 14:30:47', '06ac2466b15337', '7', '840.00', '2915', '0', '1', '6075.00', '6075', '4000', '2075', '1', '2026-10-04 14:30:47', '', '1', '0', 'سامي الشربيني', '1', '1', '3', '0', '7 - سامي الشربيني', '52' ,'0','','','','','-1','0','0','0','0','0','6075','0','','0','0','4000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','0','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=208
UPDATE client SET  clientdebt = '2915', userid = '1' WHERE clientid = '7';
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 ('7','840.00','2075','0','اضافة فاتورة مبيعات','208', '2915', '2026-10-04 14:30:47', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6075', '0', null, '0', null, null,'', '0','1','1','2075','1','2026-10-04 14:30:47','0','0','',''); -- id=348
UPDATE client SET  inUse = 0 where clientid = 7;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 132;
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 ('605','00213', '208', '13', '213', '2', '615', '1230', '0', '', '0', '2026-10-04 14:30:48', '213', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','132-2,','1','1','0','0','615','1230','0','','0','','0','0','0','0'); -- id=1788
UPDATE sellbilldetail SET  lastbuyprice = 605.00 , meanbuyprice = 605.45, lastbuyprice_withDiscount = 605.00, meanbuyprice_withDiscount = 605.45
        , lastbuyprice_withTax = 605, meanbuyprice_withTax = 605.45, lastbuyprice_withDiscountAndTax = 605
                where sellbilldetailid = 1788;
 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 (213, '2026-10-04', 1230, 1210, 1210
                    , 1210.9, 1210, 1210.9, 1210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1210, 1210.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1210.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1210.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1210.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+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-04', 1230, 1210, 1210
                    , 1210.9, 1210, 1210.9, 1210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1210, 1210.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1210.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1210.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1210.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 = '9', userid = '1', storedetaildate = '2026-10-04 14:30:48' WHERE storedetailid = '213';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('213', '1', '2', '1', '208', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '9', '1', '2026-10-04 14:30:48','0','0'); -- id=3409
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 ('77','00178', '208', '19', '178', '5', '80', '400', '0', '', '0', '2026-10-04 14:30:48', '178', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','80','400','0','','0','0.00','0','0','0','0'); -- id=1789
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 1789;
 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 (178, '2026-10-04', 400, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, 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+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-04', 400, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, 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 = '20', userid = '1', storedetaildate = '2026-10-04 14:30:48' WHERE storedetailid = '178';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('178', '1', '5', '1', '208', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '20', '1', '2026-10-04 14:30:48','0','0'); -- id=3410
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+13 where id = 28;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+27 where id = 40;
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', '208', '2', '170', '40', '74', '2960', '0', '', '0', '2026-10-04 14:30:48', '170', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','28-13,40-27,','1','1','0','0','74','2960','0','','0','0.00','0','0','0','0'); -- id=1790
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 = 1790;
 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-04', 2960, 2560, 2560
                    , 2560, 2560, 2560, 2560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 2560, 2560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2960, sellCostBuyPrice =sellCostBuyPrice+2560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2560
                        , returnSellVal = returnSellVal+0, 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-04', 2960, 2560, 2560
                    , 2560, 2560, 2560, 2560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2560, 2560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2960, sellCostBuyPrice =sellCostBuyPrice+2560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2560
                        , returnSellVal = returnSellVal+0, 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 = '86', userid = '1', storedetaildate = '2026-10-04 14:30:49' WHERE storedetailid = '170';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('170', '1', '40', '1', '208', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '86', '1', '2026-10-04 14:30:49','0','0'); -- id=3411
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 94;
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 ('270','00174', '208', '19', '174', '3', '275', '825', '0', '', '0', '2026-10-04 14:30:49', '174', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','94-3,','1','1','0','0','275','825','0','','0','0.00','0','0','0','0'); -- id=1791
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1791;
 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 (174, '2026-10-04', 825, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+825, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, 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-04', 825, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+825, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, 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-04 14:30:49' WHERE storedetailid = '174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('174', '1', '3', '1', '208', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '54', '1', '2026-10-04 14:30:49','0','0'); -- id=3412
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 95;
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 ('325','00175', '208', '19', '175', '2', '330', '660', '0', '', '0', '2026-10-04 14:30:49', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','95-2,','1','1','0','0','330','660','0','','0','0.00','0','0','0','0'); -- id=1792
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 1792;
 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 (175, '2026-10-04', 660, 650, 650
                    , 650, 650, 650, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 650, 650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+650
                        , returnSellVal = returnSellVal+0, 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-04', 660, 650, 650
                    , 650, 650, 650, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 650, 650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+650
                        , returnSellVal = returnSellVal+0, 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 = '66', userid = '1', storedetaildate = '2026-10-04 14:30:49' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '2', '1', '208', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '66', '1', '2026-10-04 14:30:49','0','0'); -- id=3413
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-387500.9375',  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 ('-391500.9375','4000', '0', '1', 'اضافة فاتورة مبيعات', '208', '-387500.9375', '2026-10-04 14:30:50', '1',  'sellbillController.php','7','','0'); -- id=208
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6075', '6075', '2026-10-04', '1', '0', '0', '2026-10-04 14:30:50','اضافة فاتورة مبيعات رقم 208','1','0',null,'0','208','sellbillController.php?do=showDetail&sellbillid=208'); -- id=1262
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1262', '434', '6075', '','0'); -- id=1268
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '6915', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1262', '143', '6075', '','0'); -- id=1264
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '907404.78', 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 ( '4000', '4000', '2026-10-04', '1', '0', '0', '2026-10-04 14:30:50','اضافة فاتورة مبيعات رقم 208 - تحصيل الفاتورة من العميل','1','0',null,'0','208','sellbillController.php?do=showDetail&sellbillid=208'); -- id=1263
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1263', '383', '4000', '','0'); -- id=1269
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-206111.93', 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 ('1263', '434', '4000', '','0'); -- id=1265
UPDATE accountstree SET name = 'سامي الشربيني', customName = 'سامي الشربيني', customNameEn = 'سامي الشربيني', nameEn = 'سامي الشربيني', parent = '58', accountNature = '0', theValue = '2915', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 10:02:56' WHERE id = '434';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5615', '5615', '2026-10-04', '1', '0', '0', '2026-10-04 14:30:50','اضافة فاتورة مبيعات رقم 208 - صرف البضاعة من المخزن','1','0',null,'0','208','sellbillController.php?do=showDetail&sellbillid=208'); -- id=1264
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1264', '402', '5615', '','0'); -- id=1270
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '821677.89', 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 ('1264', '382', '5615', '','0'); -- id=1266
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2489866.7', 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='1262,1263,1264' where sellbillid=208;
 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-04', 6075, 5615, 5615
                    , 5615.9, 5615, 5615.9, 5615
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5615, 5615.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6075, sellCostBuyPrice =sellCostBuyPrice+5615
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5615, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5615.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5615, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5615.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5615
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5615
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5615.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 (7, '2026-10-04', 6075, 5615, 5615
                    , 5615.9, 5615, 5615.9, 5615
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5615, 5615.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6075, sellCostBuyPrice =sellCostBuyPrice+5615
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5615, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5615.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5615, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5615.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5615
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5615
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5615.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, 6075, 5615, 5615
                    , 5615.9, 5615, 5615.9, 5615, 5615, 5615.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6075, netSellCostBuyPrice = netSellCostBuyPrice+5615
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5615
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5615.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5615
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5615.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5615
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5615
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5615.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac2466b15337 and sellbillId = 208 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:00:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:30:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:30:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3373
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:23:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:53:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:53:00', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3374
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:25:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:55:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:55:56', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3375

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac24c2d4640c
-- ----------------------------------------------------------------------------------------------------

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-04 14:55:57', '06ac24c2d4640c', '1', '0.00', '0', '0', '1', '606.00', '606', '606', '0', '1', '2026-10-04 14:55:57', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '40' ,'0','','','','','-1','0','0','0','0','0','606','0','','0','0','606','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','0','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=209
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','اضافة فاتورة مبيعات','209', '0', '2026-10-04 14:55:58', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '606', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 14:55:57','0','0','',''); -- id=349
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 37;
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.5','00164', '209', '2', '164', '15', '10.5', '157.5', '0', '', '0', '2026-10-04 14:55:58', '164', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','37-15,','1','1','0','0','10.5','157.5','0','','0','','0','0','0','0'); -- id=1793
UPDATE sellbilldetail SET  lastbuyprice = 8.50 , meanbuyprice = 8.56, lastbuyprice_withDiscount = 8.50, meanbuyprice_withDiscount = 8.56
        , lastbuyprice_withTax = 8.5, meanbuyprice_withTax = 8.56, lastbuyprice_withDiscountAndTax = 8.5
                where sellbilldetailid = 1793;
 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 (164, '2026-10-04', 157.5, 127.5, 127.5
                    , 128.4, 127.5, 128.4, 127.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 127.5, 128.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+157.5, sellCostBuyPrice =sellCostBuyPrice+127.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+127.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+128.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+127.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+128.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+127.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+127.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+128.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+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-04', 157.5, 127.5, 127.5
                    , 128.4, 127.5, 128.4, 127.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 127.5, 128.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+157.5, sellCostBuyPrice =sellCostBuyPrice+127.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+127.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+128.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+127.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+128.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+127.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+127.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+128.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 = '185', userid = '1', storedetaildate = '2026-10-04 14:55:58' WHERE storedetailid = '164';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('164', '1', '15', '1', '209', 'اضافة فاتورة مبيعات', 'sellbillController.php', '200', '185', '1', '2026-10-04 14:55:58','0','0'); -- id=3414
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', '209', '14', '81', '10', '19', '190', '0', '', '0', '2026-10-04 14:55:58', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=1794
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 = 1794;
 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-04', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, 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+10
                        , 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-04', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, 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 = '208', userid = '1', storedetaildate = '2026-10-04 14:55:58' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '209', 'اضافة فاتورة مبيعات', 'sellbillController.php', '218', '208', '1', '2026-10-04 14:55:58','0','0'); -- id=3415
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', '209', '6', '527', '2', '22', '44', '0', '', '0', '2026-10-04 14:55:59', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','22','44','0','','0','0.00','0','0','0','0'); -- id=1795
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 = 1795;
 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-04', 44, 38, 38
                    , 38, 38, 38, 38
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 38, 38, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+44, sellCostBuyPrice =sellCostBuyPrice+38
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+38, sellCostMeanBuyPrice = sellCostMeanBuyPrice+38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+38, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+38
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+38
                        , returnSellVal = returnSellVal+0, 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-04', 44, 38, 38
                    , 38, 38, 38, 38
                    , 0, 0, 0, 0
                    , 0, 0, 0, 38, 38, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+44, sellCostBuyPrice =sellCostBuyPrice+38
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+38, sellCostMeanBuyPrice = sellCostMeanBuyPrice+38
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+38, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+38
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+38
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+38
                        , returnSellVal = returnSellVal+0, 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-04 14:55:59' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '2', '1', '209', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '17', '1', '2026-10-04 14:55:59','0','0'); -- id=3416
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','00239', '209', '2', '239', '13', '16.5', '214.5', '0', '', '0', '2026-10-04 14:55:59', '239', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','16.5','214.5','0','','0','0.00','0','0','0','0'); -- id=1796
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 1796;
 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 (239, '2026-10-04', 214.5, 208, 208
                    , 208, 208, 208, 208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 0, 208, 208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+214.5, sellCostBuyPrice =sellCostBuyPrice+208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+208
                        , returnSellVal = returnSellVal+0, 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+13
                        , 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-04', 214.5, 208, 208
                    , 208, 208, 208, 208
                    , 0, 0, 0, 0
                    , 0, 0, 0, 208, 208, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+214.5, sellCostBuyPrice =sellCostBuyPrice+208
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+208, sellCostMeanBuyPrice = sellCostMeanBuyPrice+208
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+208, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+208
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+208
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+208
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+208
                        , returnSellVal = returnSellVal+0, 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 = '155', userid = '1', storedetaildate = '2026-10-04 14:55:59' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '13', '1', '209', 'اضافة فاتورة مبيعات', 'sellbillController.php', '168', '155', '1', '2026-10-04 14:55:59','0','0'); -- id=3417
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-386894.9375',  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 ('-387500.9375','606', '0', '1', 'اضافة فاتورة مبيعات', '209', '-386894.9375', '2026-10-04 14:55:59', '1',  'sellbillController.php','1','','0'); -- id=209
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '606', '606', '2026-10-04', '1', '0', '0', '2026-10-04 14:55:59','اضافة فاتورة مبيعات رقم 209','1','0',null,'0','209','sellbillController.php?do=showDetail&sellbillid=209'); -- id=1265
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1265', '383', '606', '','0'); -- id=1271
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-205505.93', 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 ('1265', '143', '606', '','0'); -- id=1267
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '908010.78', 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 ( '553.5', '553.5', '2026-10-04', '1', '0', '0', '2026-10-04 14:55:59','اضافة فاتورة مبيعات رقم 209 - صرف البضاعة من المخزن','1','0',null,'0','209','sellbillController.php?do=showDetail&sellbillid=209'); -- id=1266
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1266', '402', '553.5', '','0'); -- id=1272
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '822231.39', 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 ('1266', '382', '553.5', '','0'); -- id=1268
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2489313.2', 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='1265,0,1266' where sellbillid=209;
 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-04', 606, 553.5, 553.5
                    , 554.4, 553.5, 554.4, 553.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,553.5, 554.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+606, sellCostBuyPrice =sellCostBuyPrice+553.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+553.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+554.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+553.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+554.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+553.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+553.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+554.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;
 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-04', 606, 553.5, 553.5
                    , 554.4, 553.5, 554.4, 553.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,553.5, 554.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+606, sellCostBuyPrice =sellCostBuyPrice+553.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+553.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+554.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+553.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+554.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+553.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+553.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+554.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 606, 553.5, 553.5
                    , 554.4, 553.5, 554.4, 553.5, 553.5, 554.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+606, netSellCostBuyPrice = netSellCostBuyPrice+553.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+553.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+554.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+553.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+554.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+553.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+553.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+554.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac24c2d4640c and sellbillId = 209 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:26:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 14:56:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 14:56:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3376
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:51:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 15:21:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 15:21:52', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3377

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac24ce20ca61
-- ----------------------------------------------------------------------------------------------------

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-04 15:21:53', '06ac24ce20ca61', '1', '0.00', '0', '0', '1', '1593.70', '1593.7', '1593.7', '0', '1', '2026-10-04 15:21:53', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '5' ,'0','','','','','-1','0','0','0','0','0','1593','0','','0','0','1593.7','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=210
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','اضافة فاتورة مبيعات','210', '0', '2026-10-04 15:21:53', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1593.7', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 15:21:53','0','0','',''); -- id=350
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 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', '210', '1', '9', '4', '319', '1276', '0', '', '1', '2026-10-04 15:21:53', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-4,','1','1','0','0','319','1276','0','','0','0.00','0','0','0','0'); -- id=1797
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 = 1797;
 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-04', 1276, 1224, 1224
                    , 1224, 1224, 1224, 1224
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1224, 1224, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1276, sellCostBuyPrice =sellCostBuyPrice+1224
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1224, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1224
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1224, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1224
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1224
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1224
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1224
                        , returnSellVal = returnSellVal+0, 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-04', 1276, 1224, 1224
                    , 1224, 1224, 1224, 1224
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1224, 1224, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1276, sellCostBuyPrice =sellCostBuyPrice+1224
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1224, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1224
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1224, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1224
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1224
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1224
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1224
                        , returnSellVal = returnSellVal+0, 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 = '47', userid = '1', storedetaildate = '2026-10-04 15:21:54' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '4', '1', '210', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '47', '1', '2026-10-04 15:21:54','0','0'); -- id=3418
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', '210', '1', '13', '1', '317.7', '317.7', '0', '', '1', '2026-10-04 15:21:54', '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=1798
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 = 1798;
 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-04', 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-04', 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 = '14', userid = '1', storedetaildate = '2026-10-04 15:21:54' WHERE storedetailid = '13';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('13', '1', '1', '1', '210', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '14', '1', '2026-10-04 15:21:54','0','0'); -- id=3419
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-385301.2375',  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 ('-386894.9375','1593.7', '0', '1', 'اضافة فاتورة مبيعات', '210', '-385301.2375', '2026-10-04 15:21:54', '1',  'sellbillController.php','1','','0'); -- id=210
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1593.7', '1593.7', '2026-10-04', '1', '0', '0', '2026-10-04 15:21:54','اضافة فاتورة مبيعات رقم 210','1','0',null,'0','210','sellbillController.php?do=showDetail&sellbillid=210'); -- id=1267
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1267', '383', '1593.7', '','0'); -- id=1273
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-203912.23', 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 ('1267', '143', '1593.7', '','0'); -- id=1269
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '909604.48', 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 ( '1530', '1530', '2026-10-04', '1', '0', '0', '2026-10-04 15:21:54','اضافة فاتورة مبيعات رقم 210 - صرف البضاعة من المخزن','1','0',null,'0','210','sellbillController.php?do=showDetail&sellbillid=210'); -- id=1268
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1268', '402', '1530', '','0'); -- id=1274
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '823761.39', 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 ('1268', '382', '1530', '','0'); -- id=1270
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2487783.2', 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='1267,0,1268' where sellbillid=210;
 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-04', 1593.7, 1530, 1530
                    , 1530, 1530, 1530, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1530, 1530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1593.7, sellCostBuyPrice =sellCostBuyPrice+1530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1530
                        , returnSellVal = returnSellVal+0, 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-04', 1593.7, 1530, 1530
                    , 1530, 1530, 1530, 1530
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1530, 1530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1593.7, sellCostBuyPrice =sellCostBuyPrice+1530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1530
                        , returnSellVal = returnSellVal+0, 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, 1593.7, 1530, 1530
                    , 1530, 1530, 1530, 1530, 1530, 1530)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1593.7, netSellCostBuyPrice = netSellCostBuyPrice+1530
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1530
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1530
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1530
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1530
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1530
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1530
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1530;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac24ce20ca61 and sellbillId = 210 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 11:51:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 15:21:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 15:21:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3378
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:34:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:04:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:04:02', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3379

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac252f4e259c
-- ----------------------------------------------------------------------------------------------------

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-04 16:04:07', '06ac252f4e259c', '1', '0.00', '0', '0', '1', '2250.00', '2250', '2250', '0', '1', '2026-10-04 16:04:07', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','2250','0','','0','0','2250','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=211
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','اضافة فاتورة مبيعات','211', '0', '2026-10-04 16:04:07', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2250', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 16:04:07','0','0','',''); -- id=351
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 ('2000','00251', '211', '10', '251', '1', '2250', '2250', '0', '', '1', '2026-10-04 16:04:07', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2250','2250','0','','0','0.00','0','0','0','0'); -- id=1799
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2000.00, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2000.00
        , lastbuyprice_withTax = 2000, meanbuyprice_withTax = 2000, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 1799;
 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 (251, '2026-10-04', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, 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-04', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, 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 = '38', userid = '1', storedetaildate = '2026-10-04 16:04:08' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '211', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '38', '1', '2026-10-04 16:04:08','0','0'); -- id=3420
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-383051.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 ('-385301.25','2250', '0', '1', 'اضافة فاتورة مبيعات', '211', '-383051.25', '2026-10-04 16:04:08', '1',  'sellbillController.php','1','','0'); -- id=211
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2250', '2250', '2026-10-04', '1', '0', '0', '2026-10-04 16:04:08','اضافة فاتورة مبيعات رقم 211','1','0',null,'0','211','sellbillController.php?do=showDetail&sellbillid=211'); -- id=1269
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1269', '383', '2250', '','0'); -- id=1275
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-201662.23', 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 ('1269', '143', '2250', '','0'); -- id=1271
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '911854.48', 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 ( '2000', '2000', '2026-10-04', '1', '0', '0', '2026-10-04 16:04:08','اضافة فاتورة مبيعات رقم 211 - صرف البضاعة من المخزن','1','0',null,'0','211','sellbillController.php?do=showDetail&sellbillid=211'); -- id=1270
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1270', '402', '2000', '','0'); -- id=1276
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '825761.39', 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 ('1270', '382', '2000', '','0'); -- id=1272
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2485783.2', 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='1269,0,1270' where sellbillid=211;
 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-04', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, 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-04', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, 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, 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000, 2000, 2000)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2250, netSellCostBuyPrice = netSellCostBuyPrice+2000
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2000
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2000
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2000
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2000
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2000
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2000
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2000;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac252f4e259c and sellbillId = 211 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:34:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:04:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:04:10', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3380
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:34:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:04:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:04:13', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3381
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:34:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:04:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:04:46', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=3382
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '100', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '20', '120', '1', '2026-10-04','0','0'); -- id=3421
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2100', '2100', '2026-10-04', '1', '0', '0', '2026-10-04 16:04:47','اعادة جرد للمنتج : (متر سلك 3 ملي الفؤاد/اسلاك) فى مخزن : (المخزن الرئيسي) بالكمية : 120','1','0',null,'0','3421','inventoryController.php?do=details&id=3421'); -- id=1271
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1271', '382', '2100', '','0'); -- id=1277
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2487883.2', 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 ('1271', '188', '2100', '','0'); -- id=1273
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-57076.05', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:35:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:05:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:05:02', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3383
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:35:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:05:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:05:10', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3384
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:35:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:05:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:05:39', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=3385
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '376';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '1', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '22', '30', '1', '2026-10-04','0','0'); -- id=3422
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1528', '1528', '2026-10-04', '1', '0', '0', '2026-10-04 16:05:39','اعادة جرد للمنتج : (وش وتربروف ابيض /كيون) فى مخزن : (المخزن الرئيسي) بالكمية : 30','1','0',null,'0','3422','inventoryController.php?do=details&id=3422'); -- id=1272
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1272', '382', '1528', '','0'); -- id=1278
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2489411.2', 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 ('1272', '188', '1528', '','0'); -- id=1274
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-58604.05', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:38:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:08:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:08:20', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3386
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:40:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:10:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:10:27', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=3387
UPDATE storedetail SET  productquantity = '500', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('137', '1', '100', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '400', '500', '1', '2026-10-04','0','0'); -- id=3423
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1610', '1610', '2026-10-04', '1', '0', '0', '2026-10-04 16:10:28','اعادة جرد للمنتج : (شاسيه مفرد ابيض جديد/ريدي رونج) فى مخزن : (المخزن الرئيسي) بالكمية : 500','1','0',null,'0','3423','inventoryController.php?do=details&id=3423'); -- id=1273
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1273', '382', '1610', '','0'); -- id=1279
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491021.2', 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 ('1273', '188', '1610', '','0'); -- id=1275
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-60214.05', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:43:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:13:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:13:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3388
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:43:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:13:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:13:47', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=3389
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:44:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:14:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:14:28', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3390
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:46:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:16:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:16:56', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3391
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 ('مفتاح مروحه سرعات ','','1','190','193','197','193','2026-10-04','0','1','0','','0','0','0','0','0','190','190','190','190','190','0','1.58','1.58','3.68','.','0','0','0','190','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','190','190','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','190','0','0','0','0','0','0','','','0','0','0','0'); -- id=566
UPDATE product SET productName = 'مفتاح مروحه سرعات ', productDescription = '', productCatId = '1', productBuyPrice = '190', productSellAllPrice = '193', productSellUnitPrice = '197', productSellHalfPrice = '193', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00566',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '1.58' , buyhalf_precentage = '1.58' , buypart_precentage = '3.68',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',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='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '566';
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', '566', '1.00', '2026-10-04', '1', '0','0056601','193','193','197','190','','0','0','0','0','0','0','0','0','0','0'); -- id=566
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('566', '1', '30', '1', '2026-10-04'); -- id=566
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('566', '1', '30', '0', '566', 'إضافة منتج', 'productController.php', '0', '30', '1', '2026-10-04','0','0'); -- id=3424
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (566, 1,'2026-10-04 16:16:57',1)
                ON DUPLICATE KEY UPDATE productid = 566, edited = 1, sysdate = '2026-10-04 16:16:57', userid = 1; -- id=723
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5700', '5700', '2026-10-04', '1', '0', '0', '2026-10-04 16:16:57','إضافة منتج مفتاح مروحه سرعات  الكمية 30','1','0','0','0','566','productController.php?do=edit&id=566'); -- id=1274
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1274', '382', '5700', '','0'); -- id=1280
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2496721.2', 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 ('1274', '121', '5700', '','0'); -- id=1276
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1671666.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 = '1', productBuyPrice = '190.00', productSellAllPrice = '193.00', productSellUnitPrice = '197.00', productSellHalfPrice = '193.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00566',type ='0', expireDate = '0' , dailyentryId = '1274',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '1.58' , buyhalf_precentage = '1.58' , buypart_precentage = '3.68',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',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='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '566';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:47:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:17:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:17:00', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3392
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:47:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:17:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:17:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3393
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:47:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:17:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:17:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3394
UPDATE product SET productName = 'ديمر مروحه اسمر', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '193.00', productSellUnitPrice = '197.00', productSellHalfPrice = '193.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00566',type ='0', expireDate = '0' , dailyentryId = '1274',isService = '0',isOptic = '0',lastbuyprice = '190.00',lastbuyprice_withDiscount = '190',meanbuyprice = '190.00',meanbuyprice_withDiscount = '190' , productbuypricereal = '190.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.58' , buyhalf_precentage = '1.58' , buypart_precentage = '3.68',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '566';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (566, 1,'2026-10-04 16:20:03',1)
                ON DUPLICATE KEY UPDATE productid = 566, edited = 1, sysdate = '2026-10-04 16:20:03', userid = 1; -- id=723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:50:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:20:22', '1', 'executeOperation', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=executeOperation'); -- id=3395
BEGIN;
UPDATE dailyentry SET totalcreditor = '5700.00', totaldebtor = '5700.00', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 16:16:57', entryComment = 'إضافة منتج مفتاح مروحه سرعات  الكمية 30', fromFlag = '1',related='0',isopeningentry='0',operationId='566',operationDetailLink='productController.php?do=edit&id=566' WHERE id = '1274';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5700.00', '5700.00', '2026-10-04', '1', '0', '1274', '2026-10-04 16:20:23','تم عكس القيد رقم 1274 ','1','0','0','0','0',''); -- id=1275
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1275', '382', '5700.00', '','0'); -- id=1277
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491021.2', 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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1275', '121', '5700.00', '','0'); -- id=1281
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1665966.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 = '1', productBuyPrice = '190.00', productSellAllPrice = '193.00', productSellUnitPrice = '197.00', productSellHalfPrice = '193.00', productDate = '2026-10-04', conditions = '2', userId = '1', limitamount = '0', parcode = '00566',type ='0', expireDate = '0' , dailyentryId = '1275',isService = '0',isOptic = '0',lastbuyprice = '190.00',lastbuyprice_withDiscount = '190',meanbuyprice = '190.00',meanbuyprice_withDiscount = '190' , productbuypricereal = '190.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.58' , buyhalf_precentage = '1.58' , buypart_precentage = '3.68',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '566';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (566, 2,'2026-10-04 16:20:24',1)
                ON DUPLICATE KEY UPDATE productid = 566, edited = 2, sysdate = '2026-10-04 16:20:24', userid = 1; -- id=723
DELETE FROM productingredients WHERE productId = '566';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:50:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:20:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:20:24', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=sucess'); -- id=3396
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:50:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:20:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:20:26', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3397
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:50:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:20:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:20:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3398
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:53:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:23:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:23:04', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=3399
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ac25f1d5a85c', '2026-10-04 16:13:49', '1', '67268.92', '67268.92', '0', '0', '69023.00',  '69023.00', '69023', '0', '1', '2026-10-04 16:23:04', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=40
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00045', '40', '1', '45', '60', '237.5', '14250.00', '0', '', '2026-10-04 16:23:04', '45','','','0','0','0','0','0',null,'237.5','14250','0','0','0','0','0','0','0','0','1'); -- id=146
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:13:49', 1, 45, 0, 0
                    , 237.5, 60, 0, 0, 1, '2026-10-04 16:23:05')
                ON DUPLICATE KEY UPDATE buyprice = 237.5,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:23:05' ; -- id=146
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('45', '237.5', '60', '0', 'buyBillController.php', '146', '', '0', '0'); -- id=146
UPDATE product SET  productBuyPrice = "237.5" WHERE productId = 45 ;
UPDATE buybilldetail SET  quantitybefore = 64 WHERE buybilldetailid = 146 ;
UPDATE product SET productName = 'مفتاح تكييف 45 امبير ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '237.50', productSellAllPrice = '238.00', productSellUnitPrice = '246.50', productSellHalfPrice = '238.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '12', parcode = '00045',type ='0', expireDate = '0' , dailyentryId = '57',isService = '0',isOptic = '0',lastbuyprice = '237.5',lastbuyprice_withDiscount = '237.5',meanbuyprice = '237.5',meanbuyprice_withDiscount = '237.5' , productbuypricereal = '237.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.21' , buyhalf_precentage = '0.21' , buypart_precentage = '3.79',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='237.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='237.5',meanbuyprice_withTax='237.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='237.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '45';
UPDATE buybilldetail SET  lastbuyprice = 237.5 , meanbuyprice = 237.5, lastbuyprice_withDiscount = 237.5, meanbuyprice_withDiscount = 237.5
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where buybilldetailid = 146;
UPDATE productunit SET proUnitBuyPrice  = 237.5 * productnumber WHERE productid = 45;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '60', '0', '40', 'اضافة فاتورة مشتريات', 'buyBillController.php', '64', '124', '1', '2026-10-04 16:13:49','0','0'); -- id=3425
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00548', '40', '1', '548', '19', '190', '3610.00', '0', '', '2026-10-04 16:23:04', '548','','','0','0','0','0','0',null,'190','3610','0','0','0','0','0','0','0','0','1'); -- id=147
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:13:49', 1, 548, 0, 0
                    , 190, 19, 0, 0, 1, '2026-10-04 16:23:05')
                ON DUPLICATE KEY UPDATE buyprice = 190,
                        buyQuantity =buyQuantity+19, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:23:05' ; -- id=147
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('548', '190', '19', '0', 'buyBillController.php', '147', '', '0', '0'); -- id=147
UPDATE product SET  productBuyPrice = "190" WHERE productId = 548 ;
UPDATE buybilldetail SET  quantitybefore = 11 WHERE buybilldetailid = 147 ;
UPDATE product SET productName = 'ديمر مروحه ابيض', productDescription = '', productCatId = '1', productBuyPrice = '190.00', productSellAllPrice = '198.00', productSellUnitPrice = '198.00', productSellHalfPrice = '198.00', productDate = '2026-09-29', conditions = '0', userId = '1', limitamount = '0', parcode = '00548',type ='0', expireDate = '0' , dailyentryId = '1106',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.21' , buyhalf_precentage = '4.21' , buypart_precentage = '4.21',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '548';
UPDATE buybilldetail SET  lastbuyprice = 190 , meanbuyprice = 190, lastbuyprice_withDiscount = 190, meanbuyprice_withDiscount = 190
        , lastbuyprice_withTax = 190, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 190
                where buybilldetailid = 147;
UPDATE productunit SET proUnitBuyPrice  = 190 * productnumber WHERE productid = 548;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '548';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('548', '1', '19', '0', '40', 'اضافة فاتورة مشتريات', 'buyBillController.php', '11', '30', '1', '2026-10-04 16:13:49','0','0'); -- id=3426
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00020', '40', '1', '20', '23', '221', '5083.00', '0', '', '2026-10-04 16:23:04', '20','','','0','0','0','0','0',null,'221','5083','0','0','0','0','0','0','0','0','1'); -- id=148
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:13:49', 1, 20, 0, 0
                    , 221, 23, 0, 0, 1, '2026-10-04 16:23:06')
                ON DUPLICATE KEY UPDATE buyprice = 221,
                        buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:23:06' ; -- id=148
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('20', '221', '23', '0', 'buyBillController.php', '148', '', '0', '0'); -- id=148
UPDATE product SET  productBuyPrice = "221" WHERE productId = 20 ;
UPDATE buybilldetail SET  quantitybefore = 9 WHERE buybilldetailid = 148 ;
UPDATE product SET productName = 'ديمر مروحه اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '221.00', productSellAllPrice = '225.00', productSellUnitPrice = '230.00', productSellHalfPrice = '225.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '0', parcode = '00020',type ='0', expireDate = '0' , dailyentryId = '25',isService = '0',isOptic = '0',lastbuyprice = '221',lastbuyprice_withDiscount = '221',meanbuyprice = '221',meanbuyprice_withDiscount = '221' , productbuypricereal = '221.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.81' , buyhalf_precentage = '1.81' , buypart_precentage = '4.07',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='221',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='221',meanbuyprice_withTax='221',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='221',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '20';
UPDATE buybilldetail SET  lastbuyprice = 221 , meanbuyprice = 221, lastbuyprice_withDiscount = 221, meanbuyprice_withDiscount = 221
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where buybilldetailid = 148;
UPDATE productunit SET proUnitBuyPrice  = 221 * productnumber WHERE productid = 20;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '23', '0', '40', 'اضافة فاتورة مشتريات', 'buyBillController.php', '9', '32', '1', '2026-10-04 16:13:49','0','0'); -- id=3427
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00010', '40', '1', '10', '180', '237', '42660.00', '0', '', '2026-10-04 16:23:04', '10','','','0','0','0','0','0',null,'237','42660','0','0','0','0','0','0','0','0','1'); -- id=149
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:13:49', 1, 10, 0, 0
                    , 237, 180, 0, 0, 1, '2026-10-04 16:23:07')
                ON DUPLICATE KEY UPDATE buyprice = 237,
                        buyQuantity =buyQuantity+180, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:23:07' ; -- id=149
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('10', '237', '180', '0', 'buyBillController.php', '149', '', '0', '0'); -- id=149
UPDATE product SET  productBuyPrice = "237" WHERE productId = 10 ;
UPDATE buybilldetail SET  quantitybefore = 61 WHERE buybilldetailid = 149 ;
UPDATE product SET productName = 'مفتاح تكييف 45 امبير اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '237.00', productSellAllPrice = '239.00', productSellUnitPrice = '246.50', productSellHalfPrice = '239.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '12', parcode = '00010',type ='0', expireDate = '0' , dailyentryId = '15',isService = '0',isOptic = '0',lastbuyprice = '237',lastbuyprice_withDiscount = '237',meanbuyprice = '237',meanbuyprice_withDiscount = '237' , productbuypricereal = '237.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.84' , buyhalf_precentage = '0.84' , buypart_precentage = '4.01',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='237',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='237',meanbuyprice_withTax='237',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='237',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '10';
UPDATE buybilldetail SET  lastbuyprice = 237 , meanbuyprice = 237, lastbuyprice_withDiscount = 237, meanbuyprice_withDiscount = 237
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where buybilldetailid = 149;
UPDATE productunit SET proUnitBuyPrice  = 237 * productnumber WHERE productid = 10;
UPDATE storedetail SET  productquantity = '241', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '180', '0', '40', 'اضافة فاتورة مشتريات', 'buyBillController.php', '61', '241', '1', '2026-10-04 16:13:49','0','0'); -- id=3428
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00017', '40', '1', '17', '36', '95', '3420.00', '0', '', '2026-10-04 16:23:04', '17','','','0','0','0','0','0',null,'95','3420','0','0','0','0','0','0','0','0','1'); -- id=150
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:13:49', 1, 17, 0, 0
                    , 95, 36, 0, 0, 1, '2026-10-04 16:23:08')
                ON DUPLICATE KEY UPDATE buyprice = 95,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:23:08' ; -- id=150
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('17', '95', '36', '0', 'buyBillController.php', '150', '', '0', '0'); -- id=150
UPDATE product SET  productBuyPrice = "95" WHERE productId = 17 ;
UPDATE buybilldetail SET  quantitybefore = 39 WHERE buybilldetailid = 150 ;
UPDATE product SET productName = 'مفتاح مجوز اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '95.00', productSellAllPrice = '96.00', productSellUnitPrice = '98.90', productSellHalfPrice = '96.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '36', parcode = '00017',type ='0', expireDate = '0' , dailyentryId = '22',isService = '0',isOptic = '0',lastbuyprice = '95',lastbuyprice_withDiscount = '95',meanbuyprice = '95',meanbuyprice_withDiscount = '95' , productbuypricereal = '95.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.05' , buyhalf_precentage = '1.05' , buypart_precentage = '4.11',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='95',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='95',meanbuyprice_withTax='95',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='95',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '17';
UPDATE buybilldetail SET  lastbuyprice = 95 , meanbuyprice = 95, lastbuyprice_withDiscount = 95, meanbuyprice_withDiscount = 95
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where buybilldetailid = 150;
UPDATE productunit SET proUnitBuyPrice  = 95 * productnumber WHERE productid = 17;
UPDATE storedetail SET  productquantity = '75', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '17';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '1', '36', '0', '40', 'اضافة فاتورة مشتريات', 'buyBillController.php', '39', '75', '1', '2026-10-04 16:13:49','0','0'); -- id=3429
UPDATE supplier SET  suppliercurrentDebt = '67268.92',suppliercurrentDebtInCurrency= '67268.92' , userid = '1', supplierdate = '2026-10-04 16:23:04'   WHERE supplierid = '1';
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 ('1', '67268.92', '0', '0', 'اضافة فاتورة مشتريات', '40', '67268.92', '2026-10-04 16:13:49', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','67268.92','0','67268.92','0',''); -- id=72
UPDATE save SET  savecurrentvalue = '-452074.25',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-383051.25','69023', '1', '1', 'اضافة فاتورة مشتريات', '40', '-452074.25', '2026-10-04 16:13:49', '1',  'buyBillController.php','0','','0'); -- id=212
update buybill set dailyentryid='0,0' where buybillid=40;
COMMIT;
UPDATE product SET overAllAveragePrice = 237 WHERE productId = 10;UPDATE product SET overAllAveragePrice = 95 WHERE productId = 17;UPDATE product SET overAllAveragePrice = 221 WHERE productId = 20;UPDATE product SET overAllAveragePrice = 237.5 WHERE productId = 45;UPDATE product SET overAllAveragePrice = 190 WHERE productId = 548;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:53:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:23:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:23:09', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=40'); -- id=3400
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:56:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:26:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:26:17', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3401
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:56:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:26:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:26:27', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3402
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:56:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:26:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 16:26:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3403
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:57:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:27:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 16:27:43', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3404
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:57:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:27:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 16:27:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3405
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:57:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:27:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:27:55', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=198'); -- id=3406
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:58:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:28:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:28:03', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3407
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:58:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:28:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:28:18', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3408
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:58:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:28:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:28:46', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=3409
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:59:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:29:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:29:11', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=3410
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ac2629ef1123', '2026-10-04 16:28:47', '1', '67268.92', '67268.92', '0', '0', '5030.00',  '5030.00', '5030', '0', '1', '2026-10-04 16:29:11', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=41
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00176', '41', '19', '176', '50', '39', '1950.00', '0', '', '2026-10-04 16:29:11', '176','','','0','0','0','0','0',null,'39','1950','0','0','0','0','0','0','0','0','1'); -- id=151
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:28:47', 1, 176, 0, 0
                    , 39, 50, 0, 0, 1, '2026-10-04 16:29:12')
                ON DUPLICATE KEY UPDATE buyprice = 39,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:29:12' ; -- id=151
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('176', '39', '50', '0', 'buyBillController.php', '151', '', '0', '0'); -- id=151
UPDATE product SET  productBuyPrice = "39" WHERE productId = 176 ;
UPDATE buybilldetail SET  quantitybefore = -14 WHERE buybilldetailid = 151 ;
UPDATE product SET productName = 'لمبه 13 وات ', productDescription = '', productCatId = '19', productBuyPrice = '39.00', productSellAllPrice = '42.00', productSellUnitPrice = '45.00', productSellHalfPrice = '42.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00176',type ='0', expireDate = '0' , dailyentryId = '203',isService = '0',isOptic = '0',lastbuyprice = '39',lastbuyprice_withDiscount = '39',meanbuyprice = '39',meanbuyprice_withDiscount = '39' , productbuypricereal = '39.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.69' , buyhalf_precentage = '7.69' , buypart_precentage = '15.38',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='39',meanbuyprice_withTax='39',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='39',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '176';
UPDATE buybilldetail SET  lastbuyprice = 39 , meanbuyprice = 39, lastbuyprice_withDiscount = 39, meanbuyprice_withDiscount = 39
        , lastbuyprice_withTax = 39, meanbuyprice_withTax = 39, lastbuyprice_withDiscountAndTax = 39
                where buybilldetailid = 151;
UPDATE productunit SET proUnitBuyPrice  = 39 * productnumber WHERE productid = 176;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '176';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('176', '1', '50', '0', '41', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-14', '36', '1', '2026-10-04 16:28:47','0','0'); -- id=3430
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00178', '41', '19', '178', '40', '77', '3080.00', '0', '', '2026-10-04 16:29:11', '178','','','0','0','0','0','0',null,'77','3080','0','0','0','0','0','0','0','0','1'); -- id=152
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-04 16:28:47', 1, 178, 0, 0
                    , 77, 40, 0, 0, 1, '2026-10-04 16:29:13')
                ON DUPLICATE KEY UPDATE buyprice = 77,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-04 16:29:13' ; -- id=152
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('178', '77', '40', '0', 'buyBillController.php', '152', '', '0', '0'); -- id=152
UPDATE product SET  productBuyPrice = "77" WHERE productId = 178 ;
UPDATE buybilldetail SET  quantitybefore = 20 WHERE buybilldetailid = 152 ;
UPDATE product SET productName = 'لمبه 23 وات ', productDescription = '', productCatId = '19', productBuyPrice = '77.00', productSellAllPrice = '80.00', productSellUnitPrice = '80.00', productSellHalfPrice = '80.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00178',type ='0', expireDate = '0' , dailyentryId = '205',isService = '0',isOptic = '0',lastbuyprice = '77',lastbuyprice_withDiscount = '77',meanbuyprice = '77',meanbuyprice_withDiscount = '77' , productbuypricereal = '77.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '3.90' , buypart_precentage = '3.90',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='77',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',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='77',meanbuyprice_withTax='77',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='77',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '178';
UPDATE buybilldetail SET  lastbuyprice = 77 , meanbuyprice = 77, lastbuyprice_withDiscount = 77, meanbuyprice_withDiscount = 77
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where buybilldetailid = 152;
UPDATE productunit SET proUnitBuyPrice  = 77 * productnumber WHERE productid = 178;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '178';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('178', '1', '40', '0', '41', 'اضافة فاتورة مشتريات', 'buyBillController.php', '20', '60', '1', '2026-10-04 16:28:47','0','0'); -- id=3431
UPDATE supplier SET  suppliercurrentDebt = '67268.92',suppliercurrentDebtInCurrency= '67268.92' , userid = '1', supplierdate = '2026-10-04 16:29:11'   WHERE supplierid = '1';
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 ('1', '67268.92', '0', '0', 'اضافة فاتورة مشتريات', '41', '67268.92', '2026-10-04 16:28:47', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','67268.92','0','67268.92','0',''); -- id=73
UPDATE save SET  savecurrentvalue = '-457104.25',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-452074.25','5030', '1', '1', 'اضافة فاتورة مشتريات', '41', '-457104.25', '2026-10-04 16:28:47', '1',  'buyBillController.php','0','','0'); -- id=213
update buybill set dailyentryid='0,0' where buybillid=41;
COMMIT;
UPDATE product SET overAllAveragePrice = 39 WHERE productId = 176;UPDATE product SET overAllAveragePrice = 77 WHERE productId = 178;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:59:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:29:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 16:29:14', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=41'); -- id=3411
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:59:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:29:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-04 16:29:21', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=3412
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 12:59:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:29:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:29:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3413
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:12:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:42:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:42:03', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3414

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac262e16f14b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(44,@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,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-04 16:42:04', '06ac262e16f14b', '44', '-1951.90', '1382.4', '0', '1', '3334.30', '3334.3', '0', '3334.3', '1', '2026-10-04 16:42:04', '', '1', '0', 'احمد فتوح خميس ', '1', '1', '3', '0', 'احمد فتوح خميس ', '13' ,'0','','','','','-1','0','0','0','0','0','3334','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=212
UPDATE client SET  clientdebt = '1382.4', userid = '1' WHERE clientid = '44';
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 ('44','-1951.90','3334.3','0','اضافة فاتورة مبيعات','212', '1382.4', '2026-10-04 16:42:04', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3334.3', '0', null, '0', null, null,'', '0','1','1','3334.3','1','2026-10-04 16:42:04','0','0','',''); -- id=352
UPDATE client SET  inUse = 0 where clientid = 44;
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 ('885','00555', '212', '6', '555', '1', '950', '950', '0', '', '1', '2026-10-04 16:42:04', '555', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','950','950','0','','0','0.00','0','0','0','0'); -- id=1800
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1800;
 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 (555, '2026-10-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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+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-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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 = '0', userid = '1', storedetaildate = '2026-10-04 16:42:05' WHERE storedetailid = '555';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '1', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-04 16:42:05','0','0'); -- id=3432
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 140;
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 ('889','00268', '212', '10', '268', '2', '995', '1990', '0', '', '1', '2026-10-04 16:42:05', '268', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','140-2,','1','1','0','0','995','1990','0','','0','0.00','0','0','0','0'); -- id=1801
UPDATE sellbilldetail SET  lastbuyprice = 889.00 , meanbuyprice = 882.83, lastbuyprice_withDiscount = 889.00, meanbuyprice_withDiscount = 882.83
        , lastbuyprice_withTax = 889, meanbuyprice_withTax = 882.83, lastbuyprice_withDiscountAndTax = 889
                where sellbilldetailid = 1801;
 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 (268, '2026-10-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04 16:42:05' WHERE storedetailid = '268';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '1', '2', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '4', '1', '2026-10-04 16:42:05','0','0'); -- id=3433
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', '212', '14', '81', '1', '19', '19', '0', '', '1', '2026-10-04 16:42:05', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=1802
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 = 1802;
 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04 16:42:05' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '208', '207', '1', '2026-10-04 16:42:05','0','0'); -- id=3434
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 47;
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 ('30.8','00082', '212', '12', '82', '6', '34', '204', '0', '', '1', '2026-10-04 16:42:05', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-6,','1','1','0','0','34','204','0','','0','0.00','0','0','0','0'); -- id=1803
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1803;
 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 (82, '2026-10-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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+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-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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 = '326', userid = '1', storedetaildate = '2026-10-04 16:42:06' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '332', '326', '1', '2026-10-04 16:42:06','0','0'); -- id=3435
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 ('140','00221', '212', '13', '221', '1', '150', '150', '0', '', '1', '2026-10-04 16:42:06', '221', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','150','0','','0','0.00','0','0','0','0'); -- id=1804
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 1804;
 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 (221, '2026-10-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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 = '12', userid = '1', storedetaildate = '2026-10-04 16:42:06' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '1', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13', '12', '1', '2026-10-04 16:42:06','0','0'); -- id=3436
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.1','00087', '212', '12', '87', '1', '11.3', '11.3', '0', '', '1', '2026-10-04 16:42:06', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=1805
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1805;
 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 (87, '2026-10-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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+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-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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 = '130', userid = '1', storedetaildate = '2026-10-04 16:42:06' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '131', '130', '1', '2026-10-04 16:42:06','0','0'); -- id=3437
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','00433', '212', '6', '433', '1', '10', '10', '0', '', '1', '2026-10-04 16:42:07', '433', '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=1806
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 1806;
 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 (433, '2026-10-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04 16:42:07' WHERE storedetailid = '433';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('433', '1', '1', '1', '212', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '7', '1', '2026-10-04 16:42:07','0','0'); -- id=3438
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3334.3', '3334.3', '2026-10-04', '1', '0', '0', '2026-10-04 16:42:07','اضافة فاتورة مبيعات رقم 212','1','0',null,'0','212','sellbillController.php?do=showDetail&sellbillid=212'); -- id=1276
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1276', '476', '3334.3', '','0'); -- id=1282
UPDATE accountstree SET name = 'احمد فتوح خميس ', customName = 'احمد فتوح خميس ', customNameEn = 'احمد فتوح خميس ', nameEn = 'احمد فتوح خميس ', parent = '58', accountNature = '0', theValue = '1382.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 08:43:22' WHERE id = '476';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1276', '143', '3334.3', '','0'); -- id=1278
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '915188.78', 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 ( '3141.9', '3141.9', '2026-10-04', '1', '0', '0', '2026-10-04 16:42:07','اضافة فاتورة مبيعات رقم 212 - صرف البضاعة من المخزن','1','0',null,'0','212','sellbillController.php?do=showDetail&sellbillid=212'); -- id=1277
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1277', '402', '3141.9', '','0'); -- id=1283
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '828903.29', 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 ('1277', '382', '3141.9', '','0'); -- id=1279
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2487879.3', 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='1276,0,1277' where sellbillid=212;
 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-04', 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3141.9, 3129.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3334.3, sellCostBuyPrice =sellCostBuyPrice+3026.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3141.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3129.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3141.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3129.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3141.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3141.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3129.56
                        , returnSellVal = returnSellVal+0, 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 (44, '2026-10-04', 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3141.9, 3129.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3334.3, sellCostBuyPrice =sellCostBuyPrice+3026.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3141.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3129.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3141.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3129.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3141.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3141.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3129.56
                        , returnSellVal = returnSellVal+0, 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, 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9, 3141.9, 3129.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3334.3, netSellCostBuyPrice = netSellCostBuyPrice+3026.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3141.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3129.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3141.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3129.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3141.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3141.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3129.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac262e16f14b and sellbillId = 212 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:12:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:42:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:42:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3415
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:24:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:54:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:54:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3416
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:24:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:54:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:54:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3417
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:24:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:54:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:54:37', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=212'); -- id=3418
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:24:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:54:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:54:42', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3419
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:24:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:54:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:54:58', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3420
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 212;
UPDATE sellbill SET  sellbillsysdate = '2026-10-04 16:54:58', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '212';
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1800;
 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 (555, '2026-10-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-950, sellCostBuyPrice =sellCostBuyPrice-885
                        , 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-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-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-950, sellCostBuyPrice =sellCostBuyPrice-885
                        , 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 = '1', userid = '1', storedetaildate = '2026-10-04 16:54:59' WHERE storedetailid = '555';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '1', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-10-04 16:42:04','0','0'); -- id=3439
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 140;
UPDATE sellbilldetail SET  lastbuyprice = 889.00 , meanbuyprice = 882.83, lastbuyprice_withDiscount = 889.00, meanbuyprice_withDiscount = 882.83
        , lastbuyprice_withTax = 889, meanbuyprice_withTax = 882.83, lastbuyprice_withDiscountAndTax = 889
                where sellbilldetailid = 1801;
 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 (268, '2026-10-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1990, sellCostBuyPrice =sellCostBuyPrice-1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1765.66
                        , returnSellVal = returnSellVal-0, 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-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1990, sellCostBuyPrice =sellCostBuyPrice-1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1765.66
                        , returnSellVal = returnSellVal-0, 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-04 16:54:59' WHERE storedetailid = '268';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '1', '2', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '6', '1', '2026-10-04 16:42:04','0','0'); -- id=3440
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 = 1802;
 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, 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 = '208', userid = '1', storedetaildate = '2026-10-04 16:54:59' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '207', '208', '1', '2026-10-04 16:42:04','0','0'); -- id=3441
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1803;
 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 (82, '2026-10-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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-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-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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 = '332', userid = '1', storedetaildate = '2026-10-04 16:54:59' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '326', '332', '1', '2026-10-04 16:42:04','0','0'); -- id=3442
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 1804;
 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 (221, '2026-10-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-140
                        , returnSellVal = returnSellVal-0, 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-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-140
                        , returnSellVal = returnSellVal-0, 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-04 16:54:59' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '1', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '13', '1', '2026-10-04 16:42:04','0','0'); -- id=3443
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1805;
 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 (87, '2026-10-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.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-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-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.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 = '131', userid = '1', storedetaildate = '2026-10-04 16:54:59' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '130', '131', '1', '2026-10-04 16:42:04','0','0'); -- id=3444
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 1806;
 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 (433, '2026-10-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10
                        , returnSellVal = returnSellVal-0, 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-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10
                        , returnSellVal = returnSellVal-0, 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-04 16:54:59' WHERE storedetailid = '433';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('433', '1', '1', '0', '212', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '8', '1', '2026-10-04 16:42:04','0','0'); -- id=3445
CALL clientInUse(44,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-1951.9', userid = '1' WHERE clientid = '44';
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 ('44','1382.40','3334.30','1','تعديل فاتورة مبيعات','212', '-1951.9', '2026-10-04 16:42:04', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3334.3', '0', null, '0', null, null,'', '0','1','1','3334.3','1','2026-10-04 16:42:04','0','0','',''); -- id=353
UPDATE client SET  inUse = 0 where clientid = 44;
 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-04', 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3141.9, 3129.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3334.3, sellCostBuyPrice =sellCostBuyPrice-3026.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3141.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3129.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3141.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3129.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3141.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3141.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3129.56
                        , returnSellVal = returnSellVal-0, 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 (44, '2026-10-04', 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3141.9, 3129.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3334.3, sellCostBuyPrice =sellCostBuyPrice-3026.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3141.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3129.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3141.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3129.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3141.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3141.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3129.56
                        , returnSellVal = returnSellVal-0, 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, 3334.3, 3026.9, 3141.9
                    , 3129.56, 3141.9, 3129.56, 3141.9, 3141.9, 3129.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3334.3, netSellCostBuyPrice = netSellCostBuyPrice-3026.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3141.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3129.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3141.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3129.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3141.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3141.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3129.56;

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


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

COMMIT;
BEGIN;
CALL clientInUse(44,@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-10-04 16:42:04', '06ac262e16f14b', '44', '-1951.90', '3932.4', '0', '1', '5884.3', '5884.3', '0', '5884.3', '1', '2026-10-04 16:42:04', '', '1', '0', 'احمد فتوح خميس ', '1', '1', '3', '0', 'احمد فتوح خميس ', '14', '212', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-04','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=213
UPDATE client SET  clientdebt = '3932.4', userid = '1' WHERE clientid = '44';
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 ('44','-1951.90','5884.3','0','اضافة فاتورة مبيعات (معدله)','213', '3932.4', '2026-10-04 16:55:00', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '5884.3', '0', null, '0', null, null,'', '0','1','1','3334.3','1','2026-10-04 16:42:04','0','0','',''); -- id=354
UPDATE client SET  inUse = 0 where clientid = 44;
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 ('885','00555', '213', '6', '555', '1.00', '950', '950', '0', '', '1', '2026-10-04 16:55:00', '555', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','950','950','0','','0','0.00','0','0','0','0'); -- id=1807
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1807;
 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 (555, '2026-10-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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+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-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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 = '0', userid = '1', storedetaildate = '2026-10-04 16:55:00' WHERE storedetailid = '555';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-10-04 16:55:00','0','0'); -- id=3446
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 140;
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 ('889','00268', '213', '10', '268', '2.00', '995', '1990', '0', '', '1', '2026-10-04 16:55:00', '268', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','140-2,','1','1','0','0','995','1990','0','','0','0.00','0','0','0','0'); -- id=1808
UPDATE sellbilldetail SET  lastbuyprice = 889.00 , meanbuyprice = 882.83, lastbuyprice_withDiscount = 889.00, meanbuyprice_withDiscount = 882.83
        , lastbuyprice_withTax = 889, meanbuyprice_withTax = 882.83, lastbuyprice_withDiscountAndTax = 889
                where sellbilldetailid = 1808;
 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 (268, '2026-10-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04 16:55:01' WHERE storedetailid = '268';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '1', '2', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '4', '1', '2026-10-04 16:55:01','0','0'); -- id=3447
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', '213', '14', '81', '1.00', '19', '19', '0', '', '1', '2026-10-04 16:55:01', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=1809
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 = 1809;
 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04 16:55:01' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '208', '207', '1', '2026-10-04 16:55:01','0','0'); -- id=3448
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 47;
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 ('30.8','00082', '213', '12', '82', '6.00', '34', '204', '0', '', '1', '2026-10-04 16:55:01', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-6,','1','1','0','0','34','204','0','','0','0.00','0','0','0','0'); -- id=1810
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1810;
 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 (82, '2026-10-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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+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-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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 = '326', userid = '1', storedetaildate = '2026-10-04 16:55:01' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '332', '326', '1', '2026-10-04 16:55:01','0','0'); -- id=3449
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 ('140','00221', '213', '13', '221', '1.00', '150', '150', '0', '', '1', '2026-10-04 16:55:01', '221', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','150','0','','0','0.00','0','0','0','0'); -- id=1811
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 1811;
 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 (221, '2026-10-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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 = '12', userid = '1', storedetaildate = '2026-10-04 16:55:02' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '13', '12', '1', '2026-10-04 16:55:02','0','0'); -- id=3450
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.1','00087', '213', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-10-04 16:55:02', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=1812
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1812;
 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 (87, '2026-10-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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+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-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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 = '130', userid = '1', storedetaildate = '2026-10-04 16:55:02' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '131', '130', '1', '2026-10-04 16:55:02','0','0'); -- id=3451
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','00433', '213', '6', '433', '1.00', '10', '10', '0', '', '1', '2026-10-04 16:55:02', '433', '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=1813
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 1813;
 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 (433, '2026-10-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04 16:55:02' WHERE storedetailid = '433';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('433', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '7', '1', '2026-10-04 16:55:02','0','0'); -- id=3452
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 79;
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 ('2350','00389', '213', '6', '389', '1', '2550', '2550', '0', '', '1', '2026-10-04 16:55:02', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','79-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=1814
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 1814;
 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 (389, '2026-10-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, 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-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, 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-04 16:55:03' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '213', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-10-04 16:55:03','0','0'); -- id=3453
UPDATE dailyentry SET totalcreditor = '3334.30', totaldebtor = '3334.30', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 16:42:07', entryComment = 'اضافة فاتورة مبيعات رقم 212', fromFlag = '1',related='0',isopeningentry='0',operationId='212',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=212' WHERE id = '1276';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3334.30', '3334.30', '2026-10-04', '1', '0', '1276', '2026-10-04 16:55:03','تم عكس القيد رقم 1276 ','1','0','0','0','0',''); -- id=1278
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1278', '476', '3334.30', '','0'); -- id=1280
UPDATE accountstree SET name = 'احمد فتوح خميس ', customName = 'احمد فتوح خميس ', customNameEn = 'احمد فتوح خميس ', nameEn = 'احمد فتوح خميس ', parent = '58', accountNature = '0', theValue = '-1951.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 08:43:22' WHERE id = '476';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1278', '143', '3334.30', '','0'); -- id=1284
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '911854.48', 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 = '3141.90', totaldebtor = '3141.90', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 16:42:07', entryComment = 'اضافة فاتورة مبيعات رقم 212 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='212',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=212' WHERE id = '1277';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3141.90', '3141.90', '2026-10-04', '1', '0', '1277', '2026-10-04 16:55:03','تم عكس القيد رقم 1277 ','1','0','0','0','0',''); -- id=1279
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1279', '402', '3141.90', '','0'); -- id=1281
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '825761.39', 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 ('1279', '382', '3141.90', '','0'); -- id=1285
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491021.2', 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 ( '5884.3', '5884.3', '2026-10-04', '1', '0', '0', '2026-10-04 16:55:04','اضافة فاتورة مبيعات رقم 213','1','0',null,'0','213','sellbillController.php?do=showDetail&sellbillid=213'); -- id=1280
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1280', '476', '5884.3', '','0'); -- id=1286
UPDATE accountstree SET name = 'احمد فتوح خميس ', customName = 'احمد فتوح خميس ', customNameEn = 'احمد فتوح خميس ', nameEn = 'احمد فتوح خميس ', parent = '58', accountNature = '0', theValue = '3932.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 08:43:22' WHERE id = '476';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1280', '143', '5884.3', '','0'); -- id=1282
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '917738.78', 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 ( '5491.9', '5491.9', '2026-10-04', '1', '0', '0', '2026-10-04 16:55:04','اضافة فاتورة مبيعات رقم 213 - صرف البضاعة من المخزن','1','0',null,'0','213','sellbillController.php?do=showDetail&sellbillid=213'); -- id=1281
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1281', '402', '5491.9', '','0'); -- id=1287
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '831253.29', 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 ('1281', '382', '5491.9', '','0'); -- id=1283
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2485529.3', 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='1280,0,1281' where sellbillid=213;
 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-04', 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5491.9, 5479.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5884.3, sellCostBuyPrice =sellCostBuyPrice+5376.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5491.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5479.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5491.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5479.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5491.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5491.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5479.56
                        , returnSellVal = returnSellVal+0, 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 (44, '2026-10-04', 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5491.9, 5479.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5884.3, sellCostBuyPrice =sellCostBuyPrice+5376.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5491.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5479.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5491.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5479.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5491.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5491.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5479.56
                        , returnSellVal = returnSellVal+0, 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, 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9, 5491.9, 5479.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5884.3, netSellCostBuyPrice = netSellCostBuyPrice+5376.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5491.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5479.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5491.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5479.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5491.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5491.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5479.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 212 and newid=213 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:25:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:55:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:55:09', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=213'); -- id=3421
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:25:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:55:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-04 16:55:26', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=3422
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-04' WHERE storedetailid = '209';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '1', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9', '8', '1', '2026-10-04','0','0'); -- id=3454
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '735', '735', '2026-10-04', '1', '0', '0', '2026-10-04 16:55:27','اعادة جرد للمنتج : (لفه سلك دش 100 ريدي رونج/اسلاك) فى مخزن : (المخزن الرئيسي) بالكمية : 8','1','0',null,'0','3454','inventoryController.php?do=details&id=3454'); -- id=1282
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1282', '188', '735', '','0'); -- id=1288
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-59479.05', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1282', '382', '735', '','0'); -- id=1284
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2484794.3', 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';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:27:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:57:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:57:35', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3423
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:27:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:57:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:57:42', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3424
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:27:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:57:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:57:48', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=213'); -- id=3425
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:28:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:58:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:58:01', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3426
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 213;
UPDATE sellbill SET  sellbillsysdate = '2026-10-04 16:58:01', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '213';
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1807;
 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 (555, '2026-10-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-950, sellCostBuyPrice =sellCostBuyPrice-885
                        , 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-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-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-950, sellCostBuyPrice =sellCostBuyPrice-885
                        , 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 = '1', userid = '1', storedetaildate = '2026-10-04 16:58:01' WHERE storedetailid = '555';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-10-04 16:42:04','0','0'); -- id=3455
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 140;
UPDATE sellbilldetail SET  lastbuyprice = 889.00 , meanbuyprice = 882.83, lastbuyprice_withDiscount = 889.00, meanbuyprice_withDiscount = 882.83
        , lastbuyprice_withTax = 889, meanbuyprice_withTax = 882.83, lastbuyprice_withDiscountAndTax = 889
                where sellbilldetailid = 1808;
 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 (268, '2026-10-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1990, sellCostBuyPrice =sellCostBuyPrice-1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1765.66
                        , returnSellVal = returnSellVal-0, 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-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1990, sellCostBuyPrice =sellCostBuyPrice-1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1765.66
                        , returnSellVal = returnSellVal-0, 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-04 16:58:01' WHERE storedetailid = '268';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '1', '2', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '6', '1', '2026-10-04 16:42:04','0','0'); -- id=3456
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 = 1809;
 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, 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 = '208', userid = '1', storedetaildate = '2026-10-04 16:58:02' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '207', '208', '1', '2026-10-04 16:42:04','0','0'); -- id=3457
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1810;
 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 (82, '2026-10-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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-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-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-204, sellCostBuyPrice =sellCostBuyPrice-184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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 = '332', userid = '1', storedetaildate = '2026-10-04 16:58:02' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '326', '332', '1', '2026-10-04 16:42:04','0','0'); -- id=3458
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 1811;
 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 (221, '2026-10-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-140
                        , returnSellVal = returnSellVal-0, 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-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-140
                        , returnSellVal = returnSellVal-0, 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-04 16:58:02' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '13', '1', '2026-10-04 16:42:04','0','0'); -- id=3459
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1812;
 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 (87, '2026-10-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.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-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-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.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 = '131', userid = '1', storedetaildate = '2026-10-04 16:58:02' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '130', '131', '1', '2026-10-04 16:42:04','0','0'); -- id=3460
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 1813;
 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 (433, '2026-10-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10
                        , returnSellVal = returnSellVal-0, 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-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10
                        , returnSellVal = returnSellVal-0, 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-04 16:58:02' WHERE storedetailid = '433';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('433', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '8', '1', '2026-10-04 16:42:04','0','0'); -- id=3461
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 79;
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 1814;
 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 (389, '2026-10-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, 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-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, 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-04 16:58:02' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '213', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-10-04 16:42:04','0','0'); -- id=3462
CALL clientInUse(44,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-1951.9', userid = '1' WHERE clientid = '44';
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 ('44','3932.40','5884.30','1','تعديل فاتورة مبيعات','213', '-1951.9', '2026-10-04 16:42:04', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '5884.3', '0', null, '0', null, null,'', '0','1','1','5884.3','1','2026-10-04 16:42:04','0','0','',''); -- id=355
UPDATE client SET  inUse = 0 where clientid = 44;
 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-04', 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5491.9, 5479.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5884.3, sellCostBuyPrice =sellCostBuyPrice-5376.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5491.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5479.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5491.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5479.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5491.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5491.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5479.56
                        , returnSellVal = returnSellVal-0, 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 (44, '2026-10-04', 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5491.9, 5479.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5884.3, sellCostBuyPrice =sellCostBuyPrice-5376.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5491.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5479.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5491.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5479.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5491.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5491.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5479.56
                        , returnSellVal = returnSellVal-0, 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, 5884.3, 5376.9, 5491.9
                    , 5479.56, 5491.9, 5479.56, 5491.9, 5491.9, 5479.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-5884.3, netSellCostBuyPrice = netSellCostBuyPrice-5376.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-5491.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-5479.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-5491.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-5479.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-5491.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-5491.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-5479.56;

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


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

COMMIT;
BEGIN;
CALL clientInUse(44,@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-10-04 16:42:04', '06ac262e16f14b', '44', '-1951.90', '4001.4', '0', '1', '5953.3', '5953.3', '0', '5953.3', '1', '2026-10-04 16:42:04', '', '1', '0', 'احمد فتوح خميس ', '1', '1', '3', '0', 'احمد فتوح خميس ', '17', '213', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-04','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=214
UPDATE client SET  clientdebt = '4001.4', userid = '1' WHERE clientid = '44';
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 ('44','-1951.90','5953.3','0','اضافة فاتورة مبيعات (معدله)','214', '4001.4', '2026-10-04 16:58:03', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '5953.3', '0', null, '0', null, null,'', '0','1','1','5884.3','1','2026-10-04 16:42:04','0','0','',''); -- id=356
UPDATE client SET  inUse = 0 where clientid = 44;
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 ('885','00555', '214', '6', '555', '1.00', '950', '950', '0', '', '1', '2026-10-04 16:58:03', '555', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','950','950','0','','0','0.00','0','0','0','0'); -- id=1815
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 1815;
 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 (555, '2026-10-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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+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-04', 950, 885, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+885
                        , 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 = '0', userid = '1', storedetaildate = '2026-10-04 16:58:03' WHERE storedetailid = '555';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-10-04 16:58:03','0','0'); -- id=3463
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 140;
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 ('889','00268', '214', '10', '268', '2.00', '995', '1990', '0', '', '1', '2026-10-04 16:58:04', '268', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','140-2,','1','1','0','0','995','1990','0','','0','0.00','0','0','0','0'); -- id=1816
UPDATE sellbilldetail SET  lastbuyprice = 889.00 , meanbuyprice = 882.83, lastbuyprice_withDiscount = 889.00, meanbuyprice_withDiscount = 882.83
        , lastbuyprice_withTax = 889, meanbuyprice_withTax = 882.83, lastbuyprice_withDiscountAndTax = 889
                where sellbilldetailid = 1816;
 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 (268, '2026-10-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04', 1990, 1778, 1778
                    , 1765.66, 1778, 1765.66, 1778
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1778, 1765.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1990, sellCostBuyPrice =sellCostBuyPrice+1778
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1778, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1765.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1778, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1765.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1778
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1778
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1765.66
                        , returnSellVal = returnSellVal+0, 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-04 16:58:04' WHERE storedetailid = '268';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('268', '1', '2', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '4', '1', '2026-10-04 16:58:04','0','0'); -- id=3464
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', '214', '14', '81', '1.00', '19', '19', '0', '', '1', '2026-10-04 16:58:04', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=1817
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 = 1817;
 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, 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-04 16:58:04' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '208', '207', '1', '2026-10-04 16:58:04','0','0'); -- id=3465
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 47;
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 ('30.8','00082', '214', '12', '82', '6.00', '34', '204', '0', '', '1', '2026-10-04 16:58:04', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-6,','1','1','0','0','34','204','0','','0','0.00','0','0','0','0'); -- id=1818
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1818;
 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 (82, '2026-10-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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+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-04', 204, 184.8, 184.8
                    , 184.8, 184.8, 184.8, 184.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.8, 184.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+204, sellCostBuyPrice =sellCostBuyPrice+184.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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 = '326', userid = '1', storedetaildate = '2026-10-04 16:58:05' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '6', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '332', '326', '1', '2026-10-04 16:58:05','0','0'); -- id=3466
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 ('140','00221', '214', '13', '221', '1.00', '150', '150', '0', '', '1', '2026-10-04 16:58:05', '221', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','150','0','','0','0.00','0','0','0','0'); -- id=1819
UPDATE sellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
        , lastbuyprice_withTax = 140, meanbuyprice_withTax = 140, lastbuyprice_withDiscountAndTax = 140
                where sellbilldetailid = 1819;
 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 (221, '2026-10-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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-04', 150, 140, 140
                    , 140, 140, 140, 140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 140, 140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+140
                        , returnSellVal = returnSellVal+0, 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 = '12', userid = '1', storedetaildate = '2026-10-04 16:58:05' WHERE storedetailid = '221';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('221', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '13', '12', '1', '2026-10-04 16:58:05','0','0'); -- id=3467
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.1','00087', '214', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-10-04 16:58:05', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=1820
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1820;
 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 (87, '2026-10-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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+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-04', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.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 = '130', userid = '1', storedetaildate = '2026-10-04 16:58:05' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '131', '130', '1', '2026-10-04 16:58:05','0','0'); -- id=3468
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','00433', '214', '6', '433', '1.00', '10', '10', '0', '', '1', '2026-10-04 16:58:05', '433', '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=1821
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 1821;
 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 (433, '2026-10-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, 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-04 16:58:06' WHERE storedetailid = '433';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('433', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '7', '1', '2026-10-04 16:58:06','0','0'); -- id=3469
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 79;
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 ('2350','00389', '214', '6', '389', '1.00', '2550', '2550', '0', '', '1', '2026-10-04 16:58:06', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','79-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=1822
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 1822;
 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 (389, '2026-10-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, 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-04', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, 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-04 16:58:06' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-10-04 16:58:06','0','0'); -- id=3470
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', '214', '6', '525', '3', '23', '69', '0', '', '1', '2026-10-04 16:58:06', '525', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','69','0','','0','0.00','0','0','0','0'); -- id=1823
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 = 1823;
 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-04', 69, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+69, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, 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-04', 69, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+69, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, 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-04 16:58:06' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '3', '1', '214', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '19', '16', '1', '2026-10-04 16:58:06','0','0'); -- id=3471
UPDATE dailyentry SET totalcreditor = '5884.30', totaldebtor = '5884.30', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 16:55:04', entryComment = 'اضافة فاتورة مبيعات رقم 213', fromFlag = '1',related='0',isopeningentry='0',operationId='213',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=213' WHERE id = '1280';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5884.30', '5884.30', '2026-10-04', '1', '0', '1280', '2026-10-04 16:58:07','تم عكس القيد رقم 1280 ','1','0','0','0','0',''); -- id=1283
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1283', '476', '5884.30', '','0'); -- id=1285
UPDATE accountstree SET name = 'احمد فتوح خميس ', customName = 'احمد فتوح خميس ', customNameEn = 'احمد فتوح خميس ', nameEn = 'احمد فتوح خميس ', parent = '58', accountNature = '0', theValue = '-1951.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 08:43:22' WHERE id = '476';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1283', '143', '5884.30', '','0'); -- id=1289
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '911854.48', 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 = '5491.90', totaldebtor = '5491.90', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 16:55:04', entryComment = 'اضافة فاتورة مبيعات رقم 213 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='213',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=213' WHERE id = '1281';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5491.90', '5491.90', '2026-10-04', '1', '0', '1281', '2026-10-04 16:58:07','تم عكس القيد رقم 1281 ','1','0','0','0','0',''); -- id=1284
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1284', '402', '5491.90', '','0'); -- id=1286
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '825761.39', 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 ('1284', '382', '5491.90', '','0'); -- id=1290
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2490286.2', 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 ( '5953.3', '5953.3', '2026-10-04', '1', '0', '0', '2026-10-04 16:58:07','اضافة فاتورة مبيعات رقم 214','1','0',null,'0','214','sellbillController.php?do=showDetail&sellbillid=214'); -- id=1285
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1285', '476', '5953.3', '','0'); -- id=1291
UPDATE accountstree SET name = 'احمد فتوح خميس ', customName = 'احمد فتوح خميس ', customNameEn = 'احمد فتوح خميس ', nameEn = 'احمد فتوح خميس ', parent = '58', accountNature = '0', theValue = '4001.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 08:43:22' WHERE id = '476';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1285', '143', '5953.3', '','0'); -- id=1287
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '917807.78', 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 ( '5551.9', '5551.9', '2026-10-04', '1', '0', '0', '2026-10-04 16:58:07','اضافة فاتورة مبيعات رقم 214 - صرف البضاعة من المخزن','1','0',null,'0','214','sellbillController.php?do=showDetail&sellbillid=214'); -- id=1286
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1286', '402', '5551.9', '','0'); -- id=1292
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '831313.29', 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 ('1286', '382', '5551.9', '','0'); -- id=1288
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2484734.3', 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='1285,0,1286' where sellbillid=214;
 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-04', 5953.3, 5436.9, 5551.9
                    , 5539.56, 5551.9, 5539.56, 5551.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5551.9, 5539.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5953.3, sellCostBuyPrice =sellCostBuyPrice+5436.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5551.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5539.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5551.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5539.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5551.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5551.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5539.56
                        , returnSellVal = returnSellVal+0, 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 (44, '2026-10-04', 5953.3, 5436.9, 5551.9
                    , 5539.56, 5551.9, 5539.56, 5551.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5551.9, 5539.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5953.3, sellCostBuyPrice =sellCostBuyPrice+5436.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5551.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5539.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5551.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5539.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5551.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5551.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5539.56
                        , returnSellVal = returnSellVal+0, 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, 5953.3, 5436.9, 5551.9
                    , 5539.56, 5551.9, 5539.56, 5551.9, 5551.9, 5539.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5953.3, netSellCostBuyPrice = netSellCostBuyPrice+5436.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5551.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5539.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5551.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5539.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5551.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5551.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5539.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 213 and newid=214 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 13:28:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 16:58:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 16:58:09', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=214'); -- id=3427
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:09:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:39:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:39:56', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3428

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac25cdb291f9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(38,@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,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-04 17:39:57', '06ac25cdb291f9', '38', '702.00', '9738.5', '0', '1', '9036.50', '9036.5', '0', '9036.5', '1', '2026-10-04 17:39:57', '', '1', '0', 'مصطفي الغرباوي ', '1', '1', '3', '0', 'مصطفي الغرباوي ', '351' ,'0','','','','','-1','0','0','0','0','0','9036','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=215
UPDATE client SET  clientdebt = '9738.5', userid = '1' WHERE clientid = '38';
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 ('38','702.00','9036.5','0','اضافة فاتورة مبيعات','215', '9738.5', '2026-10-04 17:39:57', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9036.5', '0', null, '0', null, null,'', '0','1','1','9036.5','1','2026-10-04 17:39:57','0','0','',''); -- id=357
UPDATE client SET  inUse = 0 where clientid = 38;
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', '215', '3', '102', '40', '12', '480', '0', '', '1', '2026-10-04 17:39:58', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','480','0','','0','0.00','0','0','0','0'); -- id=1824
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 = 1824;
 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, 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 = '920', userid = '1', storedetaildate = '2026-10-04 17:39:58' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '40', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '960', '920', '1', '2026-10-04 17:39:58','0','0'); -- id=3472
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','00105', '215', '3', '105', '40', '15', '600', '0', '', '1', '2026-10-04 17:39:58', '105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','600','0','','0','0.00','0','0','0','0'); -- id=1825
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 = 1825;
 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 (105, '2026-10-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, 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+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-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, 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 = '182', userid = '1', storedetaildate = '2026-10-04 17:39:58' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '222', '182', '1', '2026-10-04 17:39:58','0','0'); -- id=3473
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 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', '215', '3', '100', '30', '17.75', '532.5', '0', '', '1', '2026-10-04 17:39:58', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','96-30,','1','1','0','0','17.75','532.5','0','','0','0.00','0','0','0','0'); -- id=1826
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 = 1826;
 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, 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+30
                        , 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, 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 = '410', userid = '1', storedetaildate = '2026-10-04 17:39:59' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '30', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '440', '410', '1', '2026-10-04 17:39:59','0','0'); -- id=3474
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 97;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+38 where id = 136;
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','00101', '215', '3', '101', '40', '17.75', '710', '0', '', '1', '2026-10-04 17:39:59', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','97-2,136-38,','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=1827
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 = 1827;
 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 (101, '2026-10-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, 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-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, 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 = '442', userid = '1', storedetaildate = '2026-10-04 17:39:59' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '482', '442', '1', '2026-10-04 17:39:59','0','0'); -- id=3475
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+70 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', '215', '3', '103', '70', '5.5', '385', '0', '', '1', '2026-10-04 17:39:59', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-70,','1','1','0','0','5.5','385','0','','0','0.00','0','0','0','0'); -- id=1828
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 = 1828;
 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, 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+70
                        , 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, 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 = '1318', userid = '1', storedetaildate = '2026-10-04 17:39:59' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '70', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1388', '1318', '1', '2026-10-04 17:39:59','0','0'); -- id=3476
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 86;
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 ('234.1','00122', '215', '3', '122', '3', '245', '735', '0', '', '1', '2026-10-04 17:39:59', '122', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','86-3,','1','1','0','0','245','735','0','','0','0.00','0','0','0','0'); -- id=1829
UPDATE sellbilldetail SET  lastbuyprice = 234.10 , meanbuyprice = 236.88, lastbuyprice_withDiscount = 234.10, meanbuyprice_withDiscount = 236.88
        , lastbuyprice_withTax = 234.1, meanbuyprice_withTax = 236.88, lastbuyprice_withDiscountAndTax = 234.1
                where sellbilldetailid = 1829;
 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 (122, '2026-10-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+735, sellCostBuyPrice =sellCostBuyPrice+702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+710.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+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-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+735, sellCostBuyPrice =sellCostBuyPrice+702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+710.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 = '11', userid = '1', storedetaildate = '2026-10-04 17:40:00' WHERE storedetailid = '122';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('122', '1', '3', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '11', '1', '2026-10-04 17:40:00','0','0'); -- id=3477
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '215', '3', '116', '2', '56', '112', '0', '', '1', '2026-10-04 17:40:00', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','88-2,','1','1','0','0','56','112','0','','0','0.00','0','0','0','0'); -- id=1830
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 = 1830;
 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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+112, sellCostBuyPrice =sellCostBuyPrice+103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.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+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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+112, sellCostBuyPrice =sellCostBuyPrice+103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.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 = '52', userid = '1', storedetaildate = '2026-10-04 17:40:00' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '2', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '52', '1', '2026-10-04 17:40:00','0','0'); -- id=3478
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 89;
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 ('85.97','00115', '215', '3', '115', '2', '90.5', '181', '0', '', '1', '2026-10-04 17:40:00', '115', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','89-2,','1','1','0','0','90.5','181','0','','0','0.00','0','0','0','0'); -- id=1831
UPDATE sellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where sellbilldetailid = 1831;
 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 (115, '2026-10-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.58
                        , returnSellVal = returnSellVal+0, 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-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.58
                        , returnSellVal = returnSellVal+0, 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 = '45', userid = '1', storedetaildate = '2026-10-04 17:40:00' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '2', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '47', '45', '1', '2026-10-04 17:40:00','0','0'); -- id=3479
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 144;
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','00137', '215', '21', '137', '50', '16.7', '835', '0', '', '1', '2026-10-04 17:40:00', '137', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','144-50,','1','1','0','0','16.7','835','0','','0','0.00','0','0','0','0'); -- id=1832
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 = 1832;
 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 (137, '2026-10-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+835, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, 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+50
                        , 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-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+835, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, 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 = '450', userid = '1', storedetaildate = '2026-10-04 17:40:01' WHERE storedetailid = '137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('137', '1', '50', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '500', '450', '1', '2026-10-04 17:40:01','0','0'); -- id=3480
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 ('126.9','00067', '215', '9', '67', '10', '155', '1550', '0', '', '1', '2026-10-04 17:40:01', '67', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','155','1550','0','','0','0.00','0','0','0','0'); -- id=1833
UPDATE sellbilldetail SET  lastbuyprice = 126.90 , meanbuyprice = 126.90, lastbuyprice_withDiscount = 126.90, meanbuyprice_withDiscount = 126.90
        , lastbuyprice_withTax = 126.9, meanbuyprice_withTax = 126.9, lastbuyprice_withDiscountAndTax = 126.9
                where sellbilldetailid = 1833;
 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 (67, '2026-10-04', 1550, 1269, 1269
                    , 1269, 1269, 1269, 1269
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 1269, 1269, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1269
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1269, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1269
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1269
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1269
                        , returnSellVal = returnSellVal+0, 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+10
                        , 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-04', 1550, 1269, 1269
                    , 1269, 1269, 1269, 1269
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1269, 1269, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1269
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1269, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1269
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1269
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1269
                        , returnSellVal = returnSellVal+0, 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-04 17:40:01' WHERE storedetailid = '67';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('67', '1', '10', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '25', '1', '2026-10-04 17:40:01','0','0'); -- id=3481
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 ('129.7','00061', '215', '1', '61', '5', '136', '680', '0', '', '1', '2026-10-04 17:40:01', '61', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','680','0','','0','0.00','0','0','0','0'); -- id=1834
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1834;
 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 (61, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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 = '49', userid = '1', storedetaildate = '2026-10-04 17:40:01' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '5', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '49', '1', '2026-10-04 17:40:01','0','0'); -- id=3482
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 ('129.7','00062', '215', '1', '62', '5', '136', '680', '0', '', '1', '2026-10-04 17:40:01', '62', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','680','0','','0','0.00','0','0','0','0'); -- id=1835
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1835;
 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 (62, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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 = '19', userid = '1', storedetaildate = '2026-10-04 17:40:02' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '5', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '19', '1', '2026-10-04 17:40:02','0','0'); -- id=3483
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', '215', '3', '117', '4', '39', '156', '0', '', '1', '2026-10-04 17:40:02', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','156','0','','0','0.00','0','0','0','0'); -- id=1836
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 = 1836;
 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04 17:40:02' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '4', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '21', '1', '2026-10-04 17:40:02','0','0'); -- id=3484
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 116;
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.5','00549', '215', '2', '549', '50', '28', '1400', '0', '', '1', '2026-10-04 17:40:02', '549', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','116-50,','1','1','0','0','28','1400','0','','0','0.00','0','0','0','0'); -- id=1837
UPDATE sellbilldetail SET  lastbuyprice = 17.50 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.50, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, meanbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where sellbilldetailid = 1837;
 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 (549, '2026-10-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, 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+50
                        , 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-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, 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 = '350', userid = '1', storedetaildate = '2026-10-04 17:40:02' WHERE storedetailid = '549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('549', '1', '50', '1', '215', 'اضافة فاتورة مبيعات', 'sellbillController.php', '400', '350', '1', '2026-10-04 17:40:02','0','0'); -- id=3485
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9036.5', '9036.5', '2026-10-04', '1', '0', '0', '2026-10-04 17:40:03','اضافة فاتورة مبيعات رقم 215','1','0',null,'0','215','sellbillController.php?do=showDetail&sellbillid=215'); -- id=1287
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1287', '470', '9036.5', '','0'); -- id=1293
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '9738.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1287', '143', '9036.5', '','0'); -- id=1289
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '926844.28', 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 ( '7988.78', '7988.78', '2026-10-04', '1', '0', '0', '2026-10-04 17:40:03','اضافة فاتورة مبيعات رقم 215 - صرف البضاعة من المخزن','1','0',null,'0','215','sellbillController.php?do=showDetail&sellbillid=215'); -- id=1288
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1288', '402', '7988.78', '','0'); -- id=1294
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '839302.07', 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 ('1288', '382', '7988.78', '','0'); -- id=1290
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2476745.52', 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='1287,0,1288' where sellbillid=215;
 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-04', 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7988.78, 8000.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9036.5, sellCostBuyPrice =sellCostBuyPrice+7988.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7988.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8000.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7988.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8000.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7988.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7988.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8000.14
                        , returnSellVal = returnSellVal+0, 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 (38, '2026-10-04', 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7988.78, 8000.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9036.5, sellCostBuyPrice =sellCostBuyPrice+7988.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7988.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8000.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7988.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8000.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7988.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7988.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8000.14
                        , returnSellVal = returnSellVal+0, 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, 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78, 7988.78, 8000.14)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9036.5, netSellCostBuyPrice = netSellCostBuyPrice+7988.78
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7988.78
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8000.14
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7988.78
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8000.14
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7988.78
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7988.78
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8000.14;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac25cdb291f9 and sellbillId = 215 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:10:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:40:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:40:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3429
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:10:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:40:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:40:35', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3430
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:10:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:40:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:40:44', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3431
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:10:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:40:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:40:52', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=215'); -- id=3432
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:11:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:41:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:41:08', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3433
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 215;
UPDATE sellbill SET  sellbillsysdate = '2026-10-04 17:41:09', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '215';
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 = 1824;
 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-470, sellCostMeanBuyPrice = sellCostMeanBuyPrice-470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-470
                        , returnSellVal = returnSellVal-0, 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-470, sellCostMeanBuyPrice = sellCostMeanBuyPrice-470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-470
                        , returnSellVal = returnSellVal-0, 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 = '960', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '40', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '920', '960', '1', '2026-10-04 17:39:57','0','0'); -- id=3486
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 = 1825;
 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 (105, '2026-10-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, 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-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-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, 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 = '222', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '182', '222', '1', '2026-10-04 17:39:57','0','0'); -- id=3487
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-30 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 = 1826;
 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0,30,0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-532.5, sellCostBuyPrice =sellCostBuyPrice-528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-528, sellCostMeanBuyPrice = sellCostMeanBuyPrice-528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-528
                        , returnSellVal = returnSellVal-0, 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-30
                        , 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-532.5, sellCostBuyPrice =sellCostBuyPrice-528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-528, sellCostMeanBuyPrice = sellCostMeanBuyPrice-528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-528
                        , returnSellVal = returnSellVal-0, 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 = '440', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '30', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '410', '440', '1', '2026-10-04 17:39:57','0','0'); -- id=3488
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 97;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-38 where id = 136;
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 = 1827;
 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 (101, '2026-10-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, 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-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, 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 = '482', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '442', '482', '1', '2026-10-04 17:39:57','0','0'); -- id=3489
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-70 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 = 1828;
 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0,70,0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-385, 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-70
                        , 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-385, 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 = '1388', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '70', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1318', '1388', '1', '2026-10-04 17:39:57','0','0'); -- id=3490
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 86;
UPDATE sellbilldetail SET  lastbuyprice = 234.10 , meanbuyprice = 236.88, lastbuyprice_withDiscount = 234.10, meanbuyprice_withDiscount = 236.88
        , lastbuyprice_withTax = 234.1, meanbuyprice_withTax = 236.88, lastbuyprice_withDiscountAndTax = 234.1
                where sellbilldetailid = 1829;
 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 (122, '2026-10-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-735, sellCostBuyPrice =sellCostBuyPrice-702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-710.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-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-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-735, sellCostBuyPrice =sellCostBuyPrice-702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-710.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 = '14', userid = '1', storedetaildate = '2026-10-04 17:41:09' WHERE storedetailid = '122';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('122', '1', '3', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '11', '14', '1', '2026-10-04 17:39:57','0','0'); -- id=3491
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 88;
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 = 1830;
 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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-112, sellCostBuyPrice =sellCostBuyPrice-103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-103.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-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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-112, sellCostBuyPrice =sellCostBuyPrice-103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-103.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 = '54', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '2', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '52', '54', '1', '2026-10-04 17:39:57','0','0'); -- id=3492
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 89;
UPDATE sellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where sellbilldetailid = 1831;
 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 (115, '2026-10-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-181, sellCostBuyPrice =sellCostBuyPrice-171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice-174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-174.58
                        , returnSellVal = returnSellVal-0, 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-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-181, sellCostBuyPrice =sellCostBuyPrice-171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice-174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-174.58
                        , returnSellVal = returnSellVal-0, 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 = '47', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '2', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '47', '1', '2026-10-04 17:39:57','0','0'); -- id=3493
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-50 where id = 144;
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 = 1832;
 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 (137, '2026-10-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0,50,0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-835, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, 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-50
                        , 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-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-835, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, 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 = '500', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('137', '1', '50', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '450', '500', '1', '2026-10-04 17:39:57','0','0'); -- id=3494
UPDATE sellbilldetail SET  lastbuyprice = 126.90 , meanbuyprice = 126.90, lastbuyprice_withDiscount = 126.90, meanbuyprice_withDiscount = 126.90
        , lastbuyprice_withTax = 126.9, meanbuyprice_withTax = 126.9, lastbuyprice_withDiscountAndTax = 126.9
                where sellbilldetailid = 1833;
 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 (67, '2026-10-04', 1550, 1269, 1269
                    , 1269, 1269, 1269, 1269
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 1269, 1269, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1550, sellCostBuyPrice =sellCostBuyPrice-1269
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1269, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1269
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1269, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1269
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1269
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1269
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1269
                        , returnSellVal = returnSellVal-0, 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-10
                        , 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-04', 1550, 1269, 1269
                    , 1269, 1269, 1269, 1269
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1269, 1269, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1550, sellCostBuyPrice =sellCostBuyPrice-1269
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1269, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1269
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1269, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1269
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1269
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1269
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1269
                        , returnSellVal = returnSellVal-0, 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 = '35', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '67';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('67', '1', '10', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '35', '1', '2026-10-04 17:39:57','0','0'); -- id=3495
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1834;
 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 (61, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-680, sellCostBuyPrice =sellCostBuyPrice-648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-680, sellCostBuyPrice =sellCostBuyPrice-648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-648.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 = '54', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '5', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '49', '54', '1', '2026-10-04 17:39:57','0','0'); -- id=3496
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1835;
 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 (62, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-680, sellCostBuyPrice =sellCostBuyPrice-648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-680, sellCostBuyPrice =sellCostBuyPrice-648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-648.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 = '24', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '5', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '24', '1', '2026-10-04 17:39:57','0','0'); -- id=3497
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 = 1836;
 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-156, sellCostBuyPrice =sellCostBuyPrice-148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-148, sellCostMeanBuyPrice = sellCostMeanBuyPrice-148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-148
                        , returnSellVal = returnSellVal-0, 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-156, sellCostBuyPrice =sellCostBuyPrice-148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-148, sellCostMeanBuyPrice = sellCostMeanBuyPrice-148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-148
                        , returnSellVal = returnSellVal-0, 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-04 17:41:10' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '4', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '25', '1', '2026-10-04 17:39:57','0','0'); -- id=3498
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-50 where id = 116;
UPDATE sellbilldetail SET  lastbuyprice = 17.50 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.50, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, meanbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where sellbilldetailid = 1837;
 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 (549, '2026-10-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0,50,0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1400, sellCostBuyPrice =sellCostBuyPrice-875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-875
                        , returnSellVal = returnSellVal-0, 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-50
                        , 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-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1400, sellCostBuyPrice =sellCostBuyPrice-875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-875, sellCostMeanBuyPrice = sellCostMeanBuyPrice-875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-875
                        , returnSellVal = returnSellVal-0, 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 = '400', userid = '1', storedetaildate = '2026-10-04 17:41:10' WHERE storedetailid = '549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('549', '1', '50', '0', '215', 'تعديل فاتورة مبيعات', 'sellbillController.php', '350', '400', '1', '2026-10-04 17:39:57','0','0'); -- id=3499
CALL clientInUse(38,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '702', userid = '1' WHERE clientid = '38';
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 ('38','9738.50','9036.50','1','تعديل فاتورة مبيعات','215', '702', '2026-10-04 17:39:57', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '9036.5', '0', null, '0', null, null,'', '0','1','1','9036.5','1','2026-10-04 17:39:57','0','0','',''); -- id=358
UPDATE client SET  inUse = 0 where clientid = 38;
 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-04', 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7988.78, 8000.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9036.5, sellCostBuyPrice =sellCostBuyPrice-7988.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7988.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8000.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7988.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8000.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7988.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7988.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8000.14
                        , returnSellVal = returnSellVal-0, 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 (38, '2026-10-04', 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7988.78, 8000.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9036.5, sellCostBuyPrice =sellCostBuyPrice-7988.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7988.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8000.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7988.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8000.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7988.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7988.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8000.14
                        , returnSellVal = returnSellVal-0, 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, 9036.5, 7988.78, 7988.78
                    , 8000.14, 7988.78, 8000.14, 7988.78, 7988.78, 8000.14)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-9036.5, netSellCostBuyPrice = netSellCostBuyPrice-7988.78
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-7988.78
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-8000.14
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-7988.78
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-8000.14
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-7988.78
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-7988.78
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-8000.14;

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


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

COMMIT;
BEGIN;
CALL clientInUse(38,@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-10-04 17:39:57', '06ac25cdb291f9', '38', '702.00', '10048.5', '0', '1', '9346.5', '9346.5', '0', '9346.5', '1', '2026-10-04 17:39:57', '', '1', '0', 'مصطفي الغرباوي ', '1', '1', '3', '0', 'مصطفي الغرباوي ', '353', '215', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-04','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=216
UPDATE client SET  clientdebt = '10048.5', userid = '1' WHERE clientid = '38';
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 ('38','702.00','9346.5','0','اضافة فاتورة مبيعات (معدله)','216', '10048.5', '2026-10-04 17:41:11', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '9346.5', '0', null, '0', null, null,'', '0','1','1','9036.5','1','2026-10-04 17:39:57','0','0','',''); -- id=359
UPDATE client SET  inUse = 0 where clientid = 38;
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', '216', '3', '102', '40.00', '12', '480', '0', '', '1', '2026-10-04 17:41:11', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','480','0','','0','0.00','0','0','0','0'); -- id=1838
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 = 1838;
 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, 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-04', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, 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 = '920', userid = '1', storedetaildate = '2026-10-04 17:41:12' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '40', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '960', '920', '1', '2026-10-04 17:41:12','0','0'); -- id=3500
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','00105', '216', '3', '105', '40.00', '15', '600', '0', '', '1', '2026-10-04 17:41:12', '105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','600','0','','0','0.00','0','0','0','0'); -- id=1839
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 = 1839;
 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 (105, '2026-10-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, 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+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-04', 600, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, 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 = '182', userid = '1', storedetaildate = '2026-10-04 17:41:12' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '222', '182', '1', '2026-10-04 17:41:12','0','0'); -- id=3501
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 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', '216', '3', '100', '30.00', '17.75', '532.5', '0', '', '1', '2026-10-04 17:41:12', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','96-30,','1','1','0','0','17.75','532.5','0','','0','0.00','0','0','0','0'); -- id=1840
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 = 1840;
 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, 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+30
                        , 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-04', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, 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 = '410', userid = '1', storedetaildate = '2026-10-04 17:41:12' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '30', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '440', '410', '1', '2026-10-04 17:41:12','0','0'); -- id=3502
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 97;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+38 where id = 136;
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','00101', '216', '3', '101', '40.00', '17.75', '710', '0', '', '1', '2026-10-04 17:41:12', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','97-2,136-38,','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=1841
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 = 1841;
 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 (101, '2026-10-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, 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-04', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, 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 = '442', userid = '1', storedetaildate = '2026-10-04 17:41:13' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '482', '442', '1', '2026-10-04 17:41:13','0','0'); -- id=3503
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+70 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', '216', '3', '103', '70.00', '5.5', '385', '0', '', '1', '2026-10-04 17:41:13', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-70,','1','1','0','0','5.5','385','0','','0','0.00','0','0','0','0'); -- id=1842
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 = 1842;
 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, 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+70
                        , 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-04', 385, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, 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 = '1318', userid = '1', storedetaildate = '2026-10-04 17:41:13' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '70', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1388', '1318', '1', '2026-10-04 17:41:13','0','0'); -- id=3504
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 86;
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 ('234.1','00122', '216', '3', '122', '3.00', '245', '735', '0', '', '1', '2026-10-04 17:41:13', '122', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','86-3,','1','1','0','0','245','735','0','','0','0.00','0','0','0','0'); -- id=1843
UPDATE sellbilldetail SET  lastbuyprice = 234.10 , meanbuyprice = 236.88, lastbuyprice_withDiscount = 234.10, meanbuyprice_withDiscount = 236.88
        , lastbuyprice_withTax = 234.1, meanbuyprice_withTax = 236.88, lastbuyprice_withDiscountAndTax = 234.1
                where sellbilldetailid = 1843;
 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 (122, '2026-10-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+735, sellCostBuyPrice =sellCostBuyPrice+702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+710.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+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-04', 735, 702.3, 702.3
                    , 710.64, 702.3, 710.64, 702.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 702.3, 710.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+735, sellCostBuyPrice =sellCostBuyPrice+702.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+702.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+710.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+702.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+710.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+702.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+702.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+710.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 = '11', userid = '1', storedetaildate = '2026-10-04 17:41:13' WHERE storedetailid = '122';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('122', '1', '3', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '14', '11', '1', '2026-10-04 17:41:13','0','0'); -- id=3505
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '216', '3', '116', '2.00', '56', '112', '0', '', '1', '2026-10-04 17:41:14', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','88-2,','1','1','0','0','56','112','0','','0','0.00','0','0','0','0'); -- id=1844
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 = 1844;
 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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+112, sellCostBuyPrice =sellCostBuyPrice+103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.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+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-04', 112, 103.54, 103.54
                    , 103.92, 103.54, 103.92, 103.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 103.54, 103.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+112, sellCostBuyPrice =sellCostBuyPrice+103.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+103.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+103.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+103.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+103.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+103.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+103.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+103.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 = '52', userid = '1', storedetaildate = '2026-10-04 17:41:14' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '2', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '54', '52', '1', '2026-10-04 17:41:14','0','0'); -- id=3506
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 89;
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 ('85.97','00115', '216', '3', '115', '2.00', '90.5', '181', '0', '', '1', '2026-10-04 17:41:14', '115', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','89-2,','1','1','0','0','90.5','181','0','','0','0.00','0','0','0','0'); -- id=1845
UPDATE sellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where sellbilldetailid = 1845;
 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 (115, '2026-10-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.58
                        , returnSellVal = returnSellVal+0, 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-04', 181, 171.94, 171.94
                    , 174.58, 171.94, 174.58, 171.94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 171.94, 174.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+171.94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+171.94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.58
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+171.94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+171.94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+171.94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.58
                        , returnSellVal = returnSellVal+0, 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 = '45', userid = '1', storedetaildate = '2026-10-04 17:41:14' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '2', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '47', '45', '1', '2026-10-04 17:41:14','0','0'); -- id=3507
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 144;
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','00137', '216', '21', '137', '50.00', '16.7', '835', '0', '', '1', '2026-10-04 17:41:14', '137', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','144-50,','1','1','0','0','16.7','835','0','','0','0.00','0','0','0','0'); -- id=1846
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 = 1846;
 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 (137, '2026-10-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+835, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, 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+50
                        , 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-04', 835, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+835, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, 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 = '450', userid = '1', storedetaildate = '2026-10-04 17:41:15' WHERE storedetailid = '137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('137', '1', '50', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '500', '450', '1', '2026-10-04 17:41:15','0','0'); -- id=3508
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 ('126.9','00067', '216', '9', '67', '12', '155', '1860', '0', '', '1', '2026-10-04 17:41:15', '67', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','155','1860','0','','0','0.00','0','0','0','0'); -- id=1847
UPDATE sellbilldetail SET  lastbuyprice = 126.90 , meanbuyprice = 126.90, lastbuyprice_withDiscount = 126.90, meanbuyprice_withDiscount = 126.90
        , lastbuyprice_withTax = 126.9, meanbuyprice_withTax = 126.9, lastbuyprice_withDiscountAndTax = 126.9
                where sellbilldetailid = 1847;
 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 (67, '2026-10-04', 1860, 1522.8, 1522.8
                    , 1522.8, 1522.8, 1522.8, 1522.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 1522.8, 1522.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1522.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1522.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1522.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1522.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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+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-04', 1860, 1522.8, 1522.8
                    , 1522.8, 1522.8, 1522.8, 1522.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1522.8, 1522.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1522.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1522.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1522.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1522.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1522.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1522.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1522.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1522.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 = '23', userid = '1', storedetaildate = '2026-10-04 17:41:15' WHERE storedetailid = '67';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('67', '1', '12', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '23', '1', '2026-10-04 17:41:15','0','0'); -- id=3509
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 ('129.7','00061', '216', '1', '61', '5.00', '136', '680', '0', '', '1', '2026-10-04 17:41:15', '61', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','680','0','','0','0.00','0','0','0','0'); -- id=1848
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1848;
 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 (61, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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 = '49', userid = '1', storedetaildate = '2026-10-04 17:41:15' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '5', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '54', '49', '1', '2026-10-04 17:41:15','0','0'); -- id=3510
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 ('129.7','00062', '216', '1', '62', '5.00', '136', '680', '0', '', '1', '2026-10-04 17:41:15', '62', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','680','0','','0','0.00','0','0','0','0'); -- id=1849
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 1849;
 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 (62, '2026-10-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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-04', 680, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+680, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.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 = '19', userid = '1', storedetaildate = '2026-10-04 17:41:16' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '5', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '19', '1', '2026-10-04 17:41:16','0','0'); -- id=3511
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', '216', '3', '117', '4.00', '39', '156', '0', '', '1', '2026-10-04 17:41:16', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','156','0','','0','0.00','0','0','0','0'); -- id=1850
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 = 1850;
 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04 17:41:16' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '4', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '21', '1', '2026-10-04 17:41:16','0','0'); -- id=3512
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 116;
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.5','00549', '216', '2', '549', '50.00', '28', '1400', '0', '', '1', '2026-10-04 17:41:16', '549', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','116-50,','1','1','0','0','28','1400','0','','0','0.00','0','0','0','0'); -- id=1851
UPDATE sellbilldetail SET  lastbuyprice = 17.50 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.50, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, meanbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where sellbilldetailid = 1851;
 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 (549, '2026-10-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, 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+50
                        , 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-04', 1400, 875, 875
                    , 875, 875, 875, 875
                    , 0, 0, 0, 0
                    , 0, 0, 0, 875, 875, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, sellCostBuyPrice =sellCostBuyPrice+875
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+875, sellCostMeanBuyPrice = sellCostMeanBuyPrice+875
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+875, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+875
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+875
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+875
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+875
                        , returnSellVal = returnSellVal+0, 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 = '350', userid = '1', storedetaildate = '2026-10-04 17:41:16' WHERE storedetailid = '549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('549', '1', '50', '1', '216', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '400', '350', '1', '2026-10-04 17:41:16','0','0'); -- id=3513
UPDATE dailyentry SET totalcreditor = '9036.50', totaldebtor = '9036.50', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 17:40:03', entryComment = 'اضافة فاتورة مبيعات رقم 215', fromFlag = '1',related='0',isopeningentry='0',operationId='215',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=215' WHERE id = '1287';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9036.50', '9036.50', '2026-10-04', '1', '0', '1287', '2026-10-04 17:41:16','تم عكس القيد رقم 1287 ','1','0','0','0','0',''); -- id=1289
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1289', '470', '9036.50', '','0'); -- id=1291
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '702', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1289', '143', '9036.50', '','0'); -- id=1295
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '917807.78', 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 = '7988.78', totaldebtor = '7988.78', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 17:40:03', entryComment = 'اضافة فاتورة مبيعات رقم 215 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='215',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=215' WHERE id = '1288';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7988.78', '7988.78', '2026-10-04', '1', '0', '1288', '2026-10-04 17:41:17','تم عكس القيد رقم 1288 ','1','0','0','0','0',''); -- id=1290
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1290', '402', '7988.78', '','0'); -- id=1292
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '831313.29', 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 ('1290', '382', '7988.78', '','0'); -- id=1296
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2484734.3', 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 ( '9346.5', '9346.5', '2026-10-04', '1', '0', '0', '2026-10-04 17:41:17','اضافة فاتورة مبيعات رقم 216','1','0',null,'0','216','sellbillController.php?do=showDetail&sellbillid=216'); -- id=1291
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1291', '470', '9346.5', '','0'); -- id=1297
UPDATE accountstree SET name = 'مصطفي الغرباوي ', customName = 'مصطفي الغرباوي ', customNameEn = 'مصطفي الغرباوي ', nameEn = 'مصطفي الغرباوي ', parent = '58', accountNature = '0', theValue = '10048.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-26 13:54:52' WHERE id = '470';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1291', '143', '9346.5', '','0'); -- id=1293
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '927154.28', 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 ( '8242.58', '8242.58', '2026-10-04', '1', '0', '0', '2026-10-04 17:41:17','اضافة فاتورة مبيعات رقم 216 - صرف البضاعة من المخزن','1','0',null,'0','216','sellbillController.php?do=showDetail&sellbillid=216'); -- id=1292
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1292', '402', '8242.58', '','0'); -- id=1298
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '839555.87', 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 ('1292', '382', '8242.58', '','0'); -- id=1294
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2476491.72', 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='1291,0,1292' where sellbillid=216;
 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-04', 9346.5, 8242.58, 8242.58
                    , 8253.94, 8242.58, 8253.94, 8242.58
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8242.58, 8253.94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9346.5, sellCostBuyPrice =sellCostBuyPrice+8242.58
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8242.58, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8253.94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8242.58, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8253.94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8242.58
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8242.58
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8253.94
                        , returnSellVal = returnSellVal+0, 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 (38, '2026-10-04', 9346.5, 8242.58, 8242.58
                    , 8253.94, 8242.58, 8253.94, 8242.58
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8242.58, 8253.94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9346.5, sellCostBuyPrice =sellCostBuyPrice+8242.58
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8242.58, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8253.94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8242.58, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8253.94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8242.58
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8242.58
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8253.94
                        , returnSellVal = returnSellVal+0, 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, 9346.5, 8242.58, 8242.58
                    , 8253.94, 8242.58, 8253.94, 8242.58, 8242.58, 8253.94)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9346.5, netSellCostBuyPrice = netSellCostBuyPrice+8242.58
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8242.58
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8253.94
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8242.58
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8253.94
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8242.58
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8242.58
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8253.94;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 215 and newid=216 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:11:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:41:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:41:19', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=216'); -- id=3434
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:26:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:56:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:56:19', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3435

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac246fcad572
-- ----------------------------------------------------------------------------------------------------

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-04 17:56:20', '06ac246fcad572', '1', '0.00', '0', '0', '1', '8082.00', '8082', '8082', '0', '1', '2026-10-04 17:56:20', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '116' ,'0','','','','','-1','0','0','0','0','0','8082','0','','0','0','8082','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=217
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','اضافة فاتورة مبيعات','217', '0', '2026-10-04 17:56:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8082', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 17:56:20','0','0','',''); -- id=360
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 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', '217', '20', '196', '6', '245', '1470', '0', '', '1', '2026-10-04 17:56:20', '196', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','109-6,','1','1','0','0','245','1470','0','','0','0.00','0','0','0','0'); -- id=1852
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 = 1852;
 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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1295.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+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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1295.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 = '197', userid = '1', storedetaildate = '2026-10-04 17:56:21' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '6', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '203', '197', '1', '2026-10-04 17:56:21','0','0'); -- id=3514
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', '217', '20', '200', '2', '350', '700', '0', '', '1', '2026-10-04 17:56:21', '200', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','700','0','','0','0.00','0','0','0','0'); -- id=1853
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 = 1853;
 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, sellCostBuyPrice =sellCostBuyPrice+660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+660
                        , returnSellVal = returnSellVal+0, 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, sellCostBuyPrice =sellCostBuyPrice+660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+660
                        , returnSellVal = returnSellVal+0, 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-04 17:56:21' WHERE storedetailid = '200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('200', '1', '2', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '4', '1', '2026-10-04 17:56:21','0','0'); -- id=3515
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', '217', '20', '199', '1', '200', '200', '0', '', '1', '2026-10-04 17:56:21', '199', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','200','200','0','','0','0.00','0','0','0','0'); -- id=1854
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 = 1854;
 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, 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-04 17:56:21' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '1', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '24', '1', '2026-10-04 17:56:21','0','0'); -- id=3516
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', '217', '7', '392', '5', '5', '25', '0', '', '1', '2026-10-04 17:56:21', '392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5','25','0','','0','0.00','0','0','0','0'); -- id=1855
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 = 1855;
 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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '78', userid = '1', storedetaildate = '2026-10-04 17:56:22' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '5', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '83', '78', '1', '2026-10-04 17:56:22','0','0'); -- id=3517
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 ('9','00560', '217', '6', '560', '40', '10', '400', '0', '', '1', '2026-10-04 17:56:22', '560', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','400','0','','0','0.00','0','0','0','0'); -- id=1856
UPDATE sellbilldetail SET  lastbuyprice = 9.00 , meanbuyprice = 9.00, lastbuyprice_withDiscount = 9.00, meanbuyprice_withDiscount = 9.00
        , lastbuyprice_withTax = 9, meanbuyprice_withTax = 9, lastbuyprice_withDiscountAndTax = 9
                where sellbilldetailid = 1856;
 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 (560, '2026-10-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , 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+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-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , 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 = '40', userid = '1', storedetaildate = '2026-10-04 17:56:22' WHERE storedetailid = '560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '1', '40', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '40', '1', '2026-10-04 17:56:22','0','0'); -- id=3518
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 ('475','00028', '217', '8', '28', '4', '485', '1940', '0', '', '1', '2026-10-04 17:56:22', '28', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','485','1940','0','','0','0.00','0','0','0','0'); -- id=1857
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 475.00, meanbuyprice_withDiscount = 475.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 475
                where sellbilldetailid = 1857;
 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 (28, '2026-10-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1940, 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
                        , 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-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1940, 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;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-10-04 17:56:22' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '4', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '13', '1', '2026-10-04 17:56:22','0','0'); -- id=3519
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 ('40','00431', '217', '8', '431', '2', '45', '90', '0', '', '1', '2026-10-04 17:56:22', '431', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=1858
UPDATE sellbilldetail SET  lastbuyprice = 40.00 , meanbuyprice = 40.00, lastbuyprice_withDiscount = 40.00, meanbuyprice_withDiscount = 40.00
        , lastbuyprice_withTax = 40, meanbuyprice_withTax = 40, lastbuyprice_withDiscountAndTax = 40
                where sellbilldetailid = 1858;
 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 (431, '2026-10-04', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, 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+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-04', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, 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 = '1', userid = '1', storedetaildate = '2026-10-04 17:56:23' WHERE storedetailid = '431';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '1', '2', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '1', '1', '2026-10-04 17:56:23','0','0'); -- id=3520
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', '217', '8', '428', '2', '350', '700', '0', '', '1', '2026-10-04 17:56:23', '428', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','700','0','','0','0.00','0','0','0','0'); -- id=1859
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 = 1859;
 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-04', 700, 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+700, 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-04', 700, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, 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 = '44', userid = '1', storedetaildate = '2026-10-04 17:56:23' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '2', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '46', '44', '1', '2026-10-04 17:56:23','0','0'); -- id=3521
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 111;
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 ('650','00249', '217', '10', '249', '1', '790', '790', '0', '', '1', '2026-10-04 17:56:23', '249', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','111-1,','1','1','0','0','790','790','0','','0','0.00','0','0','0','0'); -- id=1860
UPDATE sellbilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 662.84, lastbuyprice_withDiscount = 650.00, meanbuyprice_withDiscount = 662.84
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 662.84, lastbuyprice_withDiscountAndTax = 650
                where sellbilldetailid = 1860;
 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 (249, '2026-10-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+662.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+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-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+662.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 = '48.85', userid = '1', storedetaildate = '2026-10-04 17:56:23' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '1', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49.85', '48.85', '1', '2026-10-04 17:56:23','0','0'); -- id=3522
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', '217', '10', '417', '25', '23.5', '587.5', '0', '', '1', '2026-10-04 17:56:24', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23.5','587.5','0','','0','0.00','0','0','0','0'); -- id=1861
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 = 1861;
 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+587.5, 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+25
                        , 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+587.5, 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 = '95', userid = '1', storedetaildate = '2026-10-04 17:56:24' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '25', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '95', '1', '2026-10-04 17:56:24','0','0'); -- id=3523
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.1','00087', '217', '12', '87', '5', '11.3', '56.5', '0', '', '1', '2026-10-04 17:56:24', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','56.5','0','','0','0.00','0','0','0','0'); -- id=1862
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1862;
 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 (87, '2026-10-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56.5, sellCostBuyPrice =sellCostBuyPrice+55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55.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-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56.5, sellCostBuyPrice =sellCostBuyPrice+55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55.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 = '125', userid = '1', storedetaildate = '2026-10-04 17:56:24' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '5', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '130', '125', '1', '2026-10-04 17:56:24','0','0'); -- id=3524
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','00089', '217', '12', '89', '10', '4.9', '49', '0', '', '1', '2026-10-04 17:56:24', '89', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4.9','49','0','','0','0.00','0','0','0','0'); -- id=1863
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.25, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.25
        , lastbuyprice_withTax = 4.25, meanbuyprice_withTax = 4.25, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 1863;
 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 (89, '2026-10-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.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+10
                        , 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-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.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 = '165', userid = '1', storedetaildate = '2026-10-04 17:56:25' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '10', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '175', '165', '1', '2026-10-04 17:56:25','0','0'); -- id=3525
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 48;
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.6','00083', '217', '12', '83', '1', '45', '45', '0', '', '1', '2026-10-04 17:56:25', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-1,','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=1864
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 1864;
 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 (83, '2026-10-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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+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-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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 = '275', userid = '1', storedetaildate = '2026-10-04 17:56:25' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '276', '275', '1', '2026-10-04 17:56:25','0','0'); -- id=3526
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 47;
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 ('30.8','00082', '217', '12', '82', '1', '34', '34', '0', '', '1', '2026-10-04 17:56:25', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-1,','1','1','0','0','34','34','0','','0','0.00','0','0','0','0'); -- id=1865
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1865;
 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 (82, '2026-10-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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 = '325', userid = '1', storedetaildate = '2026-10-04 17:56:25' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '1', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '326', '325', '1', '2026-10-04 17:56:25','0','0'); -- id=3527
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 137;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('76.5','00320', '217', '7', '320', '1', '85', '85', '0', '', '1', '2026-10-04 17:56:25', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','137-1,','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=1866
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 = 1866;
 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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.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 = '40', userid = '1', storedetaildate = '2026-10-04 17:56:26' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '1', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '41', '40', '1', '2026-10-04 17:56:26','0','0'); -- id=3528
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 16;
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','00387', '217', '7', '387', '10', '91', '910', '0', '', '1', '2026-10-04 17:56:26', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','16-5,','1','1','0','0','91','910','0','','0','0.00','0','0','0','0'); -- id=1867
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1867;
 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 (387, '2026-10-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+910, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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+10
                        , 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-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+910, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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 = '7', userid = '1', storedetaildate = '2026-10-04 17:56:26' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '1', '217', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '7', '1', '2026-10-04 17:56:26','0','0'); -- id=3529
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-449022.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 ('-457104.25','8082', '0', '1', 'اضافة فاتورة مبيعات', '217', '-449022.25', '2026-10-04 17:56:26', '1',  'sellbillController.php','1','','0'); -- id=214
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8082', '8082', '2026-10-04', '1', '0', '0', '2026-10-04 17:56:26','اضافة فاتورة مبيعات رقم 217','1','0',null,'0','217','sellbillController.php?do=showDetail&sellbillid=217'); -- id=1293
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1293', '383', '8082', '','0'); -- id=1299
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-193580.23', 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 ('1293', '143', '8082', '','0'); -- id=1295
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '935236.28', 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 ( '7235.72', '7235.72', '2026-10-04', '1', '0', '0', '2026-10-04 17:56:26','اضافة فاتورة مبيعات رقم 217 - صرف البضاعة من المخزن','1','0',null,'0','217','sellbillController.php?do=showDetail&sellbillid=217'); -- id=1294
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1294', '402', '7235.72', '','0'); -- id=1300
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '846791.59', 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 ('1294', '382', '7235.72', '','0'); -- id=1296
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2469256', 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='1293,0,1294' where sellbillid=217;
 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-04', 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7238.22, 7246.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8082, sellCostBuyPrice =sellCostBuyPrice+7240.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7235.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7246.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7235.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7246.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7235.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7238.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7246.16
                        , returnSellVal = returnSellVal+0, 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-04', 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7238.22, 7246.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8082, sellCostBuyPrice =sellCostBuyPrice+7240.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7235.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7246.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7235.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7246.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7235.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7238.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7246.16
                        , returnSellVal = returnSellVal+0, 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, 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72, 7238.22, 7246.16)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8082, netSellCostBuyPrice = netSellCostBuyPrice+7240.72
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7235.72
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7246.16
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7235.72
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7246.16
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7235.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7238.22
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7246.16;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac246fcad572 and sellbillId = 217 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:26:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:56:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:56:28', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3436
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:26:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 17:56:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 17:56:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3437
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:32:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:02:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 18:02:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3438
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:32:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:02:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 18:02:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3439
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:32:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:02:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 18:02:10', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=217'); -- id=3440
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:32:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:02:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 18:02:21', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3441
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 217;
UPDATE sellbill SET  sellbillsysdate = '2026-10-04 18:02:21', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '217';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 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 = 1852;
 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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1470, sellCostBuyPrice =sellCostBuyPrice-1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1295.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-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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1470, sellCostBuyPrice =sellCostBuyPrice-1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1295.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 = '203', userid = '1', storedetaildate = '2026-10-04 18:02:21' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '6', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '197', '203', '1', '2026-10-04 17:56:20','0','0'); -- id=3530
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 = 1853;
 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-700, sellCostBuyPrice =sellCostBuyPrice-660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-660, sellCostMeanBuyPrice = sellCostMeanBuyPrice-660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-660
                        , returnSellVal = returnSellVal-0, 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-700, sellCostBuyPrice =sellCostBuyPrice-660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-660, sellCostMeanBuyPrice = sellCostMeanBuyPrice-660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-660
                        , returnSellVal = returnSellVal-0, 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-04 18:02:21' WHERE storedetailid = '200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('200', '1', '2', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '6', '1', '2026-10-04 17:56:20','0','0'); -- id=3531
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 = 1854;
 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-200, sellCostBuyPrice =sellCostBuyPrice-188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-188.3
                        , returnSellVal = returnSellVal-0, 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-200, sellCostBuyPrice =sellCostBuyPrice-188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-188.3
                        , returnSellVal = returnSellVal-0, 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-04 18:02:22' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '1', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '25', '1', '2026-10-04 17:56:20','0','0'); -- id=3532
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 = 1855;
 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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25, sellCostBuyPrice =sellCostBuyPrice-22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-25, sellCostBuyPrice =sellCostBuyPrice-22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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 = '83', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '5', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '78', '83', '1', '2026-10-04 17:56:20','0','0'); -- id=3533
UPDATE sellbilldetail SET  lastbuyprice = 9.00 , meanbuyprice = 9.00, lastbuyprice_withDiscount = 9.00, meanbuyprice_withDiscount = 9.00
        , lastbuyprice_withTax = 9, meanbuyprice_withTax = 9, lastbuyprice_withDiscountAndTax = 9
                where sellbilldetailid = 1856;
 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 (560, '2026-10-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-400, sellCostBuyPrice =sellCostBuyPrice-360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-360
                            , 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-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-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-400, sellCostBuyPrice =sellCostBuyPrice-360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-360
                            , 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 = '80', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '1', '40', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '40', '80', '1', '2026-10-04 17:56:20','0','0'); -- id=3534
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 475.00, meanbuyprice_withDiscount = 475.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 475
                where sellbilldetailid = 1857;
 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 (28, '2026-10-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1940, 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
                        , 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-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1940, 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;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '4', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '13', '17', '1', '2026-10-04 17:56:20','0','0'); -- id=3535
UPDATE sellbilldetail SET  lastbuyprice = 40.00 , meanbuyprice = 40.00, lastbuyprice_withDiscount = 40.00, meanbuyprice_withDiscount = 40.00
        , lastbuyprice_withTax = 40, meanbuyprice_withTax = 40, lastbuyprice_withDiscountAndTax = 40
                where sellbilldetailid = 1858;
 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 (431, '2026-10-04', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, 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-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-04', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, 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 = '3', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '431';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '1', '2', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '3', '1', '2026-10-04 17:56:20','0','0'); -- id=3536
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 = 1859;
 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-04', 700, 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-700, 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-04', 700, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-700, 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 = '46', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '2', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '44', '46', '1', '2026-10-04 17:56:20','0','0'); -- id=3537
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 111;
UPDATE sellbilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 662.84, lastbuyprice_withDiscount = 650.00, meanbuyprice_withDiscount = 662.84
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 662.84, lastbuyprice_withDiscountAndTax = 650
                where sellbilldetailid = 1860;
 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 (249, '2026-10-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-790, sellCostBuyPrice =sellCostBuyPrice-650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-662.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-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-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-790, sellCostBuyPrice =sellCostBuyPrice-650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-662.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 = '49.85', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '1', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48.85', '49.85', '1', '2026-10-04 17:56:20','0','0'); -- id=3538
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 = 1861;
 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-587.5, 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-25
                        , 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-587.5, 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 = '120', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '25', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '95', '120', '1', '2026-10-04 17:56:20','0','0'); -- id=3539
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1862;
 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 (87, '2026-10-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56.5, sellCostBuyPrice =sellCostBuyPrice-55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-55.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-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56.5, sellCostBuyPrice =sellCostBuyPrice-55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-55.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 = '130', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '5', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '130', '1', '2026-10-04 17:56:20','0','0'); -- id=3540
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.25, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.25
        , lastbuyprice_withTax = 4.25, meanbuyprice_withTax = 4.25, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 1863;
 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 (89, '2026-10-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-49, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-40, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.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-10
                        , 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-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-49, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-40, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.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 = '175', userid = '1', storedetaildate = '2026-10-04 18:02:22' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '10', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '165', '175', '1', '2026-10-04 17:56:20','0','0'); -- id=3541
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 1864;
 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 (83, '2026-10-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.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-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-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.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 = '276', userid = '1', storedetaildate = '2026-10-04 18:02:23' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '275', '276', '1', '2026-10-04 17:56:20','0','0'); -- id=3542
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1865;
 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 (82, '2026-10-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-34, sellCostBuyPrice =sellCostBuyPrice-30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30.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-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-34, sellCostBuyPrice =sellCostBuyPrice-30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30.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 = '326', userid = '1', storedetaildate = '2026-10-04 18:02:23' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '1', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '325', '326', '1', '2026-10-04 17:56:20','0','0'); -- id=3543
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 137;
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 = 1866;
 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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-76.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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-76.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 = '41', userid = '1', storedetaildate = '2026-10-04 18:02:23' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '1', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '40', '41', '1', '2026-10-04 17:56:20','0','0'); -- id=3544
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 16;
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1867;
 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 (387, '2026-10-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-910, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805.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-10
                        , 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-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-910, sellCostBuyPrice =sellCostBuyPrice-800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805.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 = '17', userid = '1', storedetaildate = '2026-10-04 18:02:23' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '0', '217', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '17', '1', '2026-10-04 17:56:20','0','0'); -- id=3545
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','تعديل فاتورة مبيعات','217', '0', '2026-10-04 17:56:20', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '8082', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 17:56:20','0','0','',''); -- id=361
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-457104.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 ('-449022.25','8082', '1', '1', 'تعديل فاتورة مبيعات', '217', '-457104.25', '2026-10-04 18:02:23', '1',  'sellbillController.php','1','','0'); -- id=215
 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-04', 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7238.22, 7246.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8082, sellCostBuyPrice =sellCostBuyPrice-7240.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7235.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7246.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7235.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7246.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7235.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7238.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7246.16
                        , returnSellVal = returnSellVal-0, 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-04', 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7238.22, 7246.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8082, sellCostBuyPrice =sellCostBuyPrice-7240.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7235.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7246.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7235.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7246.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7235.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7238.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7246.16
                        , returnSellVal = returnSellVal-0, 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, 8082, 7240.72, 7235.72
                    , 7246.16, 7235.72, 7246.16, 7235.72, 7238.22, 7246.16)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-8082, netSellCostBuyPrice = netSellCostBuyPrice-7240.72
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-7235.72
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-7246.16
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-7235.72
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-7246.16
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-7235.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-7238.22
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-7246.16;

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


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 217 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-04 17:56:20', '06ac246fcad572', '1', '0.00', '0', '0', '1', '7992', '7992', '7992', '0', '1', '2026-10-04 17:56:20', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '114', '217', 'sellbillController', '0','','','','','-1','0','0','7992','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-04','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=218
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','اضافة فاتورة مبيعات (معدله)','218', '0', '2026-10-04 18:02:24', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '7992', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 17:56:20','0','0','',''); -- id=362
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 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', '218', '20', '196', '6.00', '245', '1470', '0', '', '1', '2026-10-04 18:02:24', '196', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','109-6,','1','1','0','0','245','1470','0','','0','0.00','0','0','0','0'); -- id=1868
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 = 1868;
 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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1295.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+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-04', 1470, 1307.52, 1307.52
                    , 1295.52, 1307.52, 1295.52, 1307.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1307.52, 1295.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1307.52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1295.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1295.52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1295.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 = '197', userid = '1', storedetaildate = '2026-10-04 18:02:24' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '6', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '203', '197', '1', '2026-10-04 18:02:24','0','0'); -- id=3546
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', '218', '20', '200', '2.00', '350', '700', '0', '', '1', '2026-10-04 18:02:24', '200', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','700','0','','0','0.00','0','0','0','0'); -- id=1869
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 = 1869;
 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, sellCostBuyPrice =sellCostBuyPrice+660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+660
                        , returnSellVal = returnSellVal+0, 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-04', 700, 660, 660
                    , 660, 660, 660, 660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 660, 660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, sellCostBuyPrice =sellCostBuyPrice+660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+660
                        , returnSellVal = returnSellVal+0, 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-04 18:02:25' WHERE storedetailid = '200';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('200', '1', '2', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '4', '1', '2026-10-04 18:02:25','0','0'); -- id=3547
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', '218', '20', '199', '1.00', '200', '200', '0', '', '1', '2026-10-04 18:02:25', '199', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','200','200','0','','0','0.00','0','0','0','0'); -- id=1870
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 = 1870;
 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, 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-04', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, 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-04 18:02:25' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '1', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '24', '1', '2026-10-04 18:02:25','0','0'); -- id=3548
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', '218', '7', '392', '5.00', '5', '25', '0', '', '1', '2026-10-04 18:02:25', '392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5','25','0','','0','0.00','0','0','0','0'); -- id=1871
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 = 1871;
 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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-04', 25, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '78', userid = '1', storedetaildate = '2026-10-04 18:02:25' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '5', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '83', '78', '1', '2026-10-04 18:02:25','0','0'); -- id=3549
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 ('9','00560', '218', '6', '560', '40.00', '10', '400', '0', '', '1', '2026-10-04 18:02:25', '560', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','400','0','','0','0.00','0','0','0','0'); -- id=1872
UPDATE sellbilldetail SET  lastbuyprice = 9.00 , meanbuyprice = 9.00, lastbuyprice_withDiscount = 9.00, meanbuyprice_withDiscount = 9.00
        , lastbuyprice_withTax = 9, meanbuyprice_withTax = 9, lastbuyprice_withDiscountAndTax = 9
                where sellbilldetailid = 1872;
 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 (560, '2026-10-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , 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+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-04', 400, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , 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 = '40', userid = '1', storedetaildate = '2026-10-04 18:02:26' WHERE storedetailid = '560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '1', '40', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '80', '40', '1', '2026-10-04 18:02:26','0','0'); -- id=3550
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 ('475','00028', '218', '8', '28', '4.00', '485', '1940', '0', '', '1', '2026-10-04 18:02:26', '28', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','485','1940','0','','0','0.00','0','0','0','0'); -- id=1873
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 475.00, meanbuyprice_withDiscount = 475.00
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 475
                where sellbilldetailid = 1873;
 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 (28, '2026-10-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1940, 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
                        , 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-04', 1940, 1900, 1900
                    , 1900, 1900, 1900, 1900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1900, 1900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1940, 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;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-10-04 18:02:26' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '4', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '17', '13', '1', '2026-10-04 18:02:26','0','0'); -- id=3551
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', '218', '8', '428', '2.00', '350', '700', '0', '', '1', '2026-10-04 18:02:26', '428', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','700','0','','0','0.00','0','0','0','0'); -- id=1874
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 = 1874;
 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-04', 700, 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+700, 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-04', 700, 500, 500
                    , 500, 500, 500, 500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 500, 500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+700, 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 = '44', userid = '1', storedetaildate = '2026-10-04 18:02:26' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '2', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '46', '44', '1', '2026-10-04 18:02:26','0','0'); -- id=3552
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 111;
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 ('650','00249', '218', '10', '249', '1.00', '790', '790', '0', '', '1', '2026-10-04 18:02:26', '249', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','111-1,','1','1','0','0','790','790','0','','0','0.00','0','0','0','0'); -- id=1875
UPDATE sellbilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 662.84, lastbuyprice_withDiscount = 650.00, meanbuyprice_withDiscount = 662.84
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 662.84, lastbuyprice_withDiscountAndTax = 650
                where sellbilldetailid = 1875;
 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 (249, '2026-10-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+662.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+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-04', 790, 650, 650
                    , 662.84, 650, 662.84, 650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 650, 662.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+790, sellCostBuyPrice =sellCostBuyPrice+650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+662.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+662.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+662.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 = '48.85', userid = '1', storedetaildate = '2026-10-04 18:02:27' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '1', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '49.85', '48.85', '1', '2026-10-04 18:02:27','0','0'); -- id=3553
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', '218', '10', '417', '25.00', '23.5', '587.5', '0', '', '1', '2026-10-04 18:02:27', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23.5','587.5','0','','0','0.00','0','0','0','0'); -- id=1876
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 = 1876;
 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+587.5, 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+25
                        , 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-04', 587.5, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+587.5, 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 = '95', userid = '1', storedetaildate = '2026-10-04 18:02:27' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '25', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '120', '95', '1', '2026-10-04 18:02:27','0','0'); -- id=3554
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.1','00087', '218', '12', '87', '5.00', '11.3', '56.5', '0', '', '1', '2026-10-04 18:02:27', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','56.5','0','','0','0.00','0','0','0','0'); -- id=1877
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1877;
 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 (87, '2026-10-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56.5, sellCostBuyPrice =sellCostBuyPrice+55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55.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-04', 56.5, 55.5, 55.5
                    , 55.5, 55.5, 55.5, 55.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55.5, 55.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56.5, sellCostBuyPrice =sellCostBuyPrice+55.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+55.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+55.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+55.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55.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 = '125', userid = '1', storedetaildate = '2026-10-04 18:02:27' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '5', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '130', '125', '1', '2026-10-04 18:02:27','0','0'); -- id=3555
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','00089', '218', '12', '89', '10.00', '4.9', '49', '0', '', '1', '2026-10-04 18:02:27', '89', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4.9','49','0','','0','0.00','0','0','0','0'); -- id=1878
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.25, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.25
        , lastbuyprice_withTax = 4.25, meanbuyprice_withTax = 4.25, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 1878;
 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 (89, '2026-10-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.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+10
                        , 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-04', 49, 45, 40
                    , 42.5, 40, 42.5, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.5, 42.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.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 = '165', userid = '1', storedetaildate = '2026-10-04 18:02:28' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '10', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '175', '165', '1', '2026-10-04 18:02:28','0','0'); -- id=3556
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 48;
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.6','00083', '218', '12', '83', '1.00', '45', '45', '0', '', '1', '2026-10-04 18:02:28', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-1,','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=1879
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 1879;
 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 (83, '2026-10-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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+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-04', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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 = '275', userid = '1', storedetaildate = '2026-10-04 18:02:28' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '276', '275', '1', '2026-10-04 18:02:28','0','0'); -- id=3557
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 47;
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 ('30.8','00082', '218', '12', '82', '1.00', '34', '34', '0', '', '1', '2026-10-04 18:02:28', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-1,','1','1','0','0','34','34','0','','0','0.00','0','0','0','0'); -- id=1880
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1880;
 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 (82, '2026-10-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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 = '325', userid = '1', storedetaildate = '2026-10-04 18:02:28' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '1', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '326', '325', '1', '2026-10-04 18:02:28','0','0'); -- id=3558
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 137;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('76.5','00320', '218', '7', '320', '1.00', '85', '85', '0', '', '1', '2026-10-04 18:02:28', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','137-1,','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=1881
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 = 1881;
 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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.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-04', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.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 = '40', userid = '1', storedetaildate = '2026-10-04 18:02:29' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '1', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '41', '40', '1', '2026-10-04 18:02:29','0','0'); -- id=3559
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 16;
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','00387', '218', '7', '387', '10.00', '91', '910', '0', '', '1', '2026-10-04 18:02:29', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','16-5,','1','1','0','0','91','910','0','','0','0.00','0','0','0','0'); -- id=1882
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1882;
 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 (387, '2026-10-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+910, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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+10
                        , 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-04', 910, 800, 800
                    , 805.8, 800, 805.8, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 805.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+910, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805.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 = '7', userid = '1', storedetaildate = '2026-10-04 18:02:29' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '1', '218', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '17', '7', '1', '2026-10-04 18:02:29','0','0'); -- id=3560
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-449112.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 ('-457104.25','7992', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '218', '-449112.25', '2026-10-04 18:02:29', '1',  'sellbillController.php','1','','0'); -- id=216
UPDATE dailyentry SET totalcreditor = '8082.00', totaldebtor = '8082.00', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 17:56:26', entryComment = 'اضافة فاتورة مبيعات رقم 217', fromFlag = '1',related='0',isopeningentry='0',operationId='217',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=217' WHERE id = '1293';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8082.00', '8082.00', '2026-10-04', '1', '0', '1293', '2026-10-04 18:02:29','تم عكس القيد رقم 1293 ','1','0','0','0','0',''); -- id=1295
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1295', '383', '8082.00', '','0'); -- id=1297
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-201662.23', 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 ('1295', '143', '8082.00', '','0'); -- id=1301
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '927154.28', 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 = '7235.72', totaldebtor = '7235.72', thedate = '2026-10-04', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-04 17:56:26', entryComment = 'اضافة فاتورة مبيعات رقم 217 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='217',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=217' WHERE id = '1294';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7235.72', '7235.72', '2026-10-04', '1', '0', '1294', '2026-10-04 18:02:30','تم عكس القيد رقم 1294 ','1','0','0','0','0',''); -- id=1296
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1296', '402', '7235.72', '','0'); -- id=1298
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '839555.87', 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 ('1296', '382', '7235.72', '','0'); -- id=1302
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2476491.72', 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 ( '7992', '7992', '2026-10-04', '1', '0', '0', '2026-10-04 18:02:30','اضافة فاتورة مبيعات رقم 218','1','0',null,'0','218','sellbillController.php?do=showDetail&sellbillid=218'); -- id=1297
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1297', '383', '7992', '','0'); -- id=1303
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-193670.23', 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 ('1297', '143', '7992', '','0'); -- id=1299
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '935146.28', 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 ( '7155.72', '7155.72', '2026-10-04', '1', '0', '0', '2026-10-04 18:02:30','اضافة فاتورة مبيعات رقم 218 - صرف البضاعة من المخزن','1','0',null,'0','218','sellbillController.php?do=showDetail&sellbillid=218'); -- id=1298
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1298', '402', '7155.72', '','0'); -- id=1304
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '846711.59', 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 ('1298', '382', '7155.72', '','0'); -- id=1300
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2469336', 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='1297,0,1298' where sellbillid=218;
 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-04', 7992, 7160.72, 7155.72
                    , 7166.16, 7155.72, 7166.16, 7155.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7158.22, 7166.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7992, sellCostBuyPrice =sellCostBuyPrice+7160.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7155.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7166.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7155.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7166.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7155.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7158.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7166.16
                        , returnSellVal = returnSellVal+0, 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-04', 7992, 7160.72, 7155.72
                    , 7166.16, 7155.72, 7166.16, 7155.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7158.22, 7166.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7992, sellCostBuyPrice =sellCostBuyPrice+7160.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7155.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7166.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7155.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7166.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7155.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7158.22
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7166.16
                        , returnSellVal = returnSellVal+0, 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, 7992, 7160.72, 7155.72
                    , 7166.16, 7155.72, 7166.16, 7155.72, 7158.22, 7166.16)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7992, netSellCostBuyPrice = netSellCostBuyPrice+7160.72
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7155.72
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7166.16
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7155.72
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7166.16
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7155.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7158.22
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7166.16;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 217 and newid=218 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 14:32:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:02:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 18:02:31', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=218'); -- id=3442
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:07:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:37:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 18:37:18', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3443
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:08:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:38:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 18:38:41', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3444
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 ('اب داون تاون ليد ثلاثي','','9','45','49','52','49','2026-10-04','0','1','0','','0','0','0','0','0','45','45','45','45','45','0','8.89','8.89','15.56','.','0','0','0','45','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','45','45','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','45','0','0','0','0','0','0','','','0','0','0','0'); -- id=567
UPDATE product SET productName = 'اب داون تاون ليد ثلاثي', productDescription = '', productCatId = '9', productBuyPrice = '45', productSellAllPrice = '49', productSellUnitPrice = '52', productSellHalfPrice = '49', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00567',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '45',lastbuyprice_withDiscount = '45',meanbuyprice = '45',meanbuyprice_withDiscount = '45' , productbuypricereal = '45' , buypricereal_precentage = '0' , buytotal_precentage = '8.89' , buyhalf_precentage = '8.89' , buypart_precentage = '15.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='45',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='45',meanbuyprice_withTax='45',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='45',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '567';
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', '567', '1.00', '2026-10-04', '1', '0','0056701','49','49','52','45','','0','0','0','0','0','0','0','0','0','0'); -- id=567
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('567', '1', '0', '1', '2026-10-04'); -- id=567
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('567', '1', '0', '0', '567', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-04','0','0'); -- id=3561
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (567, 1,'2026-10-04 18:38:43',1)
                ON DUPLICATE KEY UPDATE productid = 567, edited = 1, sysdate = '2026-10-04 18:38:43', userid = 1; -- id=726
UPDATE product SET productName = 'اب داون تاون ليد ثلاثي', productDescription = '', productCatId = '9', productBuyPrice = '45.00', productSellAllPrice = '49.00', productSellUnitPrice = '52.00', productSellHalfPrice = '49.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00567',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '45',lastbuyprice_withDiscount = '45',meanbuyprice = '45',meanbuyprice_withDiscount = '45' , productbuypricereal = '45' , buypricereal_precentage = '0' , buytotal_precentage = '8.89' , buyhalf_precentage = '8.89' , buypart_precentage = '15.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='45',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='45',meanbuyprice_withTax='45',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='45',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '567';
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 ('بلفونيره 30 وات كريستال تاون ليد ','','9','125','135','150','150','2026-10-04','0','1','0','','0','0','0','0','0','125','125','125','125','125','0','8','20','20','.','0','0','0','125','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','125','125','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','125','0','0','0','0','0','0','','','0','0','0','0'); -- id=568
UPDATE product SET productName = 'بلفونيره 30 وات كريستال تاون ليد ', productDescription = '', productCatId = '9', productBuyPrice = '125', productSellAllPrice = '135', productSellUnitPrice = '150', productSellHalfPrice = '150', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00568',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '125',lastbuyprice_withDiscount = '125',meanbuyprice = '125',meanbuyprice_withDiscount = '125' , productbuypricereal = '125' , buypricereal_precentage = '0' , buytotal_precentage = '8' , buyhalf_precentage = '20' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='125',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='125',meanbuyprice_withTax='125',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='125',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '568';
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', '568', '1.00', '2026-10-04', '1', '0','0056801','135','150','150','125','','0','0','0','0','0','0','0','0','0','0'); -- id=568
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('568', '1', '0', '1', '2026-10-04'); -- id=568
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('568', '1', '0', '0', '568', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-04','0','0'); -- id=3562
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (568, 1,'2026-10-04 18:38:44',1)
                ON DUPLICATE KEY UPDATE productid = 568, edited = 1, sysdate = '2026-10-04 18:38:44', userid = 1; -- id=727
UPDATE product SET productName = 'بلفونيره 30 وات كريستال تاون ليد ', productDescription = '', productCatId = '9', productBuyPrice = '125.00', productSellAllPrice = '135.00', productSellUnitPrice = '150.00', productSellHalfPrice = '150.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00568',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '125',lastbuyprice_withDiscount = '125',meanbuyprice = '125',meanbuyprice_withDiscount = '125' , productbuypricereal = '125' , buypricereal_precentage = '0' , buytotal_precentage = '8' , buyhalf_precentage = '20' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='125',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='125',meanbuyprice_withTax='125',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='125',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '568';
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 ('تراك بديل ماجنتيك 35 وات ','','9','135','150','175','150','2026-10-04','0','1','0','','0','0','0','0','0','135','135','135','135','135','0','11.11','11.11','29.63','.','0','0','0','135','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','135','135','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','135','0','0','0','0','0','0','','','0','0','0','0'); -- id=569
UPDATE product SET productName = 'تراك بديل ماجنتيك 35 وات ', productDescription = '', productCatId = '9', productBuyPrice = '135', productSellAllPrice = '150', productSellUnitPrice = '175', productSellHalfPrice = '150', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00569',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '135',lastbuyprice_withDiscount = '135',meanbuyprice = '135',meanbuyprice_withDiscount = '135' , productbuypricereal = '135' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '11.11' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='135',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='135',meanbuyprice_withTax='135',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='135',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '569';
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', '569', '1.00', '2026-10-04', '1', '0','0056901','150','150','175','135','','0','0','0','0','0','0','0','0','0','0'); -- id=569
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('569', '1', '0', '1', '2026-10-04'); -- id=569
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('569', '1', '0', '0', '569', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-04','0','0'); -- id=3563
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (569, 1,'2026-10-04 18:38:46',1)
                ON DUPLICATE KEY UPDATE productid = 569, edited = 1, sysdate = '2026-10-04 18:38:46', userid = 1; -- id=728
UPDATE product SET productName = 'تراك بديل ماجنتيك 35 وات ', productDescription = '', productCatId = '9', productBuyPrice = '135.00', productSellAllPrice = '150.00', productSellUnitPrice = '175.00', productSellHalfPrice = '150.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00569',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '135',lastbuyprice_withDiscount = '135',meanbuyprice = '135',meanbuyprice_withDiscount = '135' , productbuypricereal = '135' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '11.11' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='135',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='135',meanbuyprice_withTax='135',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='135',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '569';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:08:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:38:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 18:38:48', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3445
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:08:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:38:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-04 18:38:50', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php'); -- id=3446
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:09:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:39:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-04 18:39:03', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=add'); -- id=3447
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('تاون ليد ', '', '', '0', '', '0', '1', '2026-10-04 18:39:03', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=16
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 ('16', '0', '0', '0', 'إضافة مورد جديد', '16', '0', '2026-10-04 18:39:03', '1', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=74
UPDATE client SET clientname = '', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '', clientdetails = '', conditions = null, clientdate = '', userid = null  , clientareaid = null  ,clientcode = '',dailyentryid = null , rondomtxt = '',clientStoreIds = '', obygyPatientId = '0' , debtLimit='0' , typeclientid='',priceTypeId='0',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '16',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='0',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='0',datecustomeraccount='',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='' WHERE clientid = null;
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('تاون ليد ', 'تاون ليد ', 'تاون ليد ', 'تاون ليد ', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-10-04 18:39:04'); -- id=478
UPDATE supplier SET suppliername = 'تاون ليد ', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-10-04', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='478',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '16';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:09:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:39:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-04 18:39:05', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=sucess'); -- id=3448
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:09:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:39:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-04 18:39:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=show'); -- id=3449
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 15:09:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 18:39:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 18:39:18', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=3450
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 16:18:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 19:48:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 19:48:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3451
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 16:20:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 19:50:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 19:50:41', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3452

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac2916ead522
-- ----------------------------------------------------------------------------------------------------

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-04 19:50:41', '06ac2916ead522', '1', '0.00', '0', '0', '1', '445.35', '445.35', '445.35', '0', '1', '2026-10-04 19:50:41', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '34' ,'0','','','','','-1','0','0','0','0','0','445','0','','0','0','445.35','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=219
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','اضافة فاتورة مبيعات','219', '0', '2026-10-04 19:50:42', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '445.35', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 19:50:41','0','0','',''); -- id=363
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','00274', '219', '10', '274', '15', '8.5', '127.5', '0', '', '1', '2026-10-04 19:50:42', '274', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8.5','127.5','0','','0','0.00','0','0','0','0'); -- id=1883
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 = 1883;
 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 (274, '2026-10-04', 127.5, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+127.5, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, 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-04', 127.5, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+127.5, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, 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-04 19:50:42' WHERE storedetailid = '274';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('274', '1', '15', '1', '219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '15', '1', '2026-10-04 19:50:42','0','0'); -- id=3564
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', '219', '10', '275', '15', '17', '255', '0', '', '1', '2026-10-04 19:50:42', '275', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17','255','0','','0','0.00','0','0','0','0'); -- id=1884
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 = 1884;
 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-04', 255, 210, 330
                    , 270, 330, 270, 330
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 270, 270, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+330
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+270
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+270
                        , returnSellVal = returnSellVal+0, 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-04', 255, 210, 330
                    , 270, 330, 270, 330
                    , 0, 0, 0, 0
                    , 0, 0, 0, 270, 270, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+255, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+330
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+270
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+270
                        , returnSellVal = returnSellVal+0, 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-04 19:50:43' WHERE storedetailid = '275';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('275', '1', '15', '1', '219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '-5', '1', '2026-10-04 19:50:43','0','0'); -- id=3565
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 47;
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 ('30.8','00082', '219', '12', '82', '1', '34', '34', '0', '', '1', '2026-10-04 19:50:43', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-1,','1','1','0','0','34','34','0','','0','0.00','0','0','0','0'); -- id=1885
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 1885;
 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 (82, '2026-10-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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-04', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.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 = '324', userid = '1', storedetaildate = '2026-10-04 19:50:43' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '1', '1', '219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '325', '324', '1', '2026-10-04 19:50:43','0','0'); -- id=3566
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.1','00087', '219', '12', '87', '2', '11.3', '22.6', '0', '', '1', '2026-10-04 19:50:43', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','22.6','0','','0','0.00','0','0','0','0'); -- id=1886
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1886;
 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 (87, '2026-10-04', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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+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-04', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '123', userid = '1', storedetaildate = '2026-10-04 19:50:43' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '2', '1', '219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '125', '123', '1', '2026-10-04 19:50:43','0','0'); -- id=3567
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.9','00086', '219', '12', '86', '1', '6.25', '6.25', '0', '', '1', '2026-10-04 19:50:43', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.25','6.25','0','','0','0.00','0','0','0','0'); -- id=1887
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 1887;
 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 (86, '2026-10-04', 6.25, 5.9, 5.9
                    , 5.9, 5.9, 5.9, 5.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.9, 5.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6.25, sellCostBuyPrice =sellCostBuyPrice+5.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.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+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-04', 6.25, 5.9, 5.9
                    , 5.9, 5.9, 5.9, 5.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.9, 5.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6.25, sellCostBuyPrice =sellCostBuyPrice+5.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.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 = '434', userid = '1', storedetaildate = '2026-10-04 19:50:44' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '1', '1', '219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '435', '434', '1', '2026-10-04 19:50:44','0','0'); -- id=3568
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-448666.9',  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 ('-449112.25','445.35', '0', '1', 'اضافة فاتورة مبيعات', '219', '-448666.9', '2026-10-04 19:50:44', '1',  'sellbillController.php','1','','0'); -- id=217
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '445.35', '445.35', '2026-10-04', '1', '0', '0', '2026-10-04 19:50:44','اضافة فاتورة مبيعات رقم 219','1','0',null,'0','219','sellbillController.php?do=showDetail&sellbillid=219'); -- id=1299
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1299', '383', '445.35', '','0'); -- id=1305
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-193224.88', 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 ('1299', '143', '445.35', '','0'); -- id=1301
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '935591.63', 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 ( '568.9', '568.9', '2026-10-04', '1', '0', '0', '2026-10-04 19:50:44','اضافة فاتورة مبيعات رقم 219 - صرف البضاعة من المخزن','1','0',null,'0','219','sellbillController.php?do=showDetail&sellbillid=219'); -- id=1300
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1300', '402', '568.9', '','0'); -- id=1306
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '847280.49', 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 ('1300', '382', '568.9', '','0'); -- id=1302
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2468767.1', 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='1299,0,1300' where sellbillid=219;
 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-04', 445.35, 448.9, 568.9
                    , 508.9, 568.9, 508.9, 568.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,508.9, 508.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+445.35, sellCostBuyPrice =sellCostBuyPrice+448.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+568.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+508.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+568.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+508.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+568.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+508.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+508.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 (1, '2026-10-04', 445.35, 448.9, 568.9
                    , 508.9, 568.9, 508.9, 568.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,508.9, 508.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+445.35, sellCostBuyPrice =sellCostBuyPrice+448.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+568.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+508.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+568.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+508.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+568.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+508.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+508.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, 445.35, 448.9, 568.9
                    , 508.9, 568.9, 508.9, 568.9, 508.9, 508.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+445.35, netSellCostBuyPrice = netSellCostBuyPrice+448.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+568.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+508.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+568.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+508.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+568.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+508.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+508.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac2916ead522 and sellbillId = 219 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 16:20:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 19:50:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 19:50:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3453
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:33:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:03:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:03:57', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3454
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:35:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:05:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:05:31', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3455
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','2150','2400','2400','2400','2026-10-04','0','1','0','','0','0','0','0','0','2150','2150','2150','2150','2150','0','11.63','11.63','11.63','.','0','0','0','2150','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','2150','2150','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','2150','0','0','0','0','0','0','','','0','0','0','0'); -- id=570
UPDATE product SET productName = 'نجفه كريستال كبيره مستورد', productDescription = '', productCatId = '16', productBuyPrice = '2150', productSellAllPrice = '2400', productSellUnitPrice = '2400', productSellHalfPrice = '2400', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00570',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '2150',lastbuyprice_withDiscount = '2150',meanbuyprice = '2150',meanbuyprice_withDiscount = '2150' , productbuypricereal = '2150' , buypricereal_precentage = '0' , buytotal_precentage = '11.63' , buyhalf_precentage = '11.63' , buypart_precentage = '11.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2150',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='2150',meanbuyprice_withTax='2150',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='2150',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '570';
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', '570', '1.00', '2026-10-04', '1', '0','0057001','2400','2400','2400','2150','','0','0','0','0','0','0','0','0','0','0'); -- id=570
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('570', '1', '1', '1', '2026-10-04'); -- id=570
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '1', '1', '0', '570', 'إضافة منتج', 'productController.php', '0', '1', '1', '2026-10-04','0','0'); -- id=3569
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (570, 1,'2026-10-04 21:05:33',1)
                ON DUPLICATE KEY UPDATE productid = 570, edited = 1, sysdate = '2026-10-04 21:05:33', userid = 1; -- id=729
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2150', '2150', '2026-10-04', '1', '0', '0', '2026-10-04 21:05:33','إضافة منتج نجفه كريستال كبيره مستورد الكمية 1','1','0','0','0','570','productController.php?do=edit&id=570'); -- id=1301
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1301', '382', '2150', '','0'); -- id=1307
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2470917.1', 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 ('1301', '121', '2150', '','0'); -- id=1303
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1668116.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 = '2150.00', productSellAllPrice = '2400.00', productSellUnitPrice = '2400.00', productSellHalfPrice = '2400.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00570',type ='0', expireDate = '0' , dailyentryId = '1301',isService = '0',isOptic = '0',lastbuyprice = '2150',lastbuyprice_withDiscount = '2150',meanbuyprice = '2150',meanbuyprice_withDiscount = '2150' , productbuypricereal = '2150' , buypricereal_precentage = '0' , buytotal_precentage = '11.63' , buyhalf_precentage = '11.63' , buypart_precentage = '11.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2150',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='2150',meanbuyprice_withTax='2150',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='2150',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '570';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:35:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:05:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:05:36', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3456
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:39:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:09:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:09:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3457
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:39:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:09:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:09:54', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3458
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 ('مروحه سقف حجازي استار ','','6','1920','1950','1980','1950','2026-10-04','0','1','0','','0','0','0','0','0','1920','1920','1920','1920','1920','0','1.56','1.56','3.13','.','0','0','0','1920','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','1920','1920','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','1920','0','0','0','0','0','0','','','0','0','0','0'); -- id=571
UPDATE product SET productName = 'مروحه سقف حجازي استار ', productDescription = '', productCatId = '6', productBuyPrice = '1920', productSellAllPrice = '1950', productSellUnitPrice = '1980', productSellHalfPrice = '1950', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00571',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1920',lastbuyprice_withDiscount = '1920',meanbuyprice = '1920',meanbuyprice_withDiscount = '1920' , productbuypricereal = '1920' , buypricereal_precentage = '0' , buytotal_precentage = '1.56' , buyhalf_precentage = '1.56' , buypart_precentage = '3.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1920',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='1920',meanbuyprice_withTax='1920',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='1920',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '571';
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', '571', '1.00', '2026-10-04', '1', '0','0057101','1950','1950','1980','1920','','0','0','0','0','0','0','0','0','0','0'); -- id=571
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('571', '1', '5', '1', '2026-10-04'); -- id=571
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '5', '0', '571', 'إضافة منتج', 'productController.php', '0', '5', '1', '2026-10-04','0','0'); -- id=3570
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (571, 1,'2026-10-04 21:09:55',1)
                ON DUPLICATE KEY UPDATE productid = 571, edited = 1, sysdate = '2026-10-04 21:09:55', userid = 1; -- id=730
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9600', '9600', '2026-10-04', '1', '0', '0', '2026-10-04 21:09:55','إضافة منتج مروحه سقف حجازي استار  الكمية 5','1','0','0','0','571','productController.php?do=edit&id=571'); -- id=1302
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1302', '382', '9600', '','0'); -- id=1308
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2480517.1', 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 ('1302', '121', '9600', '','0'); -- id=1304
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1677716.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 = '6', productBuyPrice = '1920.00', productSellAllPrice = '1950.00', productSellUnitPrice = '1980.00', productSellHalfPrice = '1950.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00571',type ='0', expireDate = '0' , dailyentryId = '1302',isService = '0',isOptic = '0',lastbuyprice = '1920',lastbuyprice_withDiscount = '1920',meanbuyprice = '1920',meanbuyprice_withDiscount = '1920' , productbuypricereal = '1920' , buypricereal_precentage = '0' , buytotal_precentage = '1.56' , buyhalf_precentage = '1.56' , buypart_precentage = '3.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1920',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='1920',meanbuyprice_withTax='1920',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='1920',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '571';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:39:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:09:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:09:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:40:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:10:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:10:37', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3460
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 ('بلفونيره 50 وات خارج ','','19','450','465','475','465','2026-10-04','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','3.33','3.33','5.56','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=572
UPDATE product SET productName = 'بلفونيره 50 وات خارج ', productDescription = '', productCatId = '19', productBuyPrice = '450', productSellAllPrice = '465', productSellUnitPrice = '475', productSellHalfPrice = '465', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00572',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '3.33' , buyhalf_precentage = '3.33' , buypart_precentage = '5.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '572';
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', '572', '1.00', '2026-10-04', '1', '0','0057201','465','465','475','450','','0','0','0','0','0','0','0','0','0','0'); -- id=572
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('572', '1', '2', '1', '2026-10-04'); -- id=572
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '1', '2', '0', '572', 'إضافة منتج', 'productController.php', '0', '2', '1', '2026-10-04','0','0'); -- id=3571
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (572, 1,'2026-10-04 21:10:39',1)
                ON DUPLICATE KEY UPDATE productid = 572, edited = 1, sysdate = '2026-10-04 21:10:39', userid = 1; -- id=731
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '900', '900', '2026-10-04', '1', '0', '0', '2026-10-04 21:10:39','إضافة منتج بلفونيره 50 وات خارج  الكمية 2','1','0','0','0','572','productController.php?do=edit&id=572'); -- id=1303
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1303', '382', '900', '','0'); -- id=1309
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2481417.1', 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 ('1303', '121', '900', '','0'); -- id=1305
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1678616.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 = 'بلفونيره 50 وات خارج ', productDescription = '', productCatId = '19', productBuyPrice = '450.00', productSellAllPrice = '465.00', productSellUnitPrice = '475.00', productSellHalfPrice = '465.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00572',type ='0', expireDate = '0' , dailyentryId = '1303',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '3.33' , buyhalf_precentage = '3.33' , buypart_precentage = '5.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '572';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:40:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:10:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:10:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3461
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:45:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:15:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-04 21:15:08', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3462
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','290','299','299','299','2026-10-04','0','1','0','','0','0','0','0','0','290','290','290','290','290','0','3.1','3.1','3.1','.','0','0','0','290','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','290','290','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','290','0','0','0','0','0','0','','','0','0','0','0'); -- id=573
UPDATE product SET productName = 'كشاف طوارئ ابيض ', productDescription = '', productCatId = '3', productBuyPrice = '290', productSellAllPrice = '299', productSellUnitPrice = '299', productSellHalfPrice = '299', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00573',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '290',lastbuyprice_withDiscount = '290',meanbuyprice = '290',meanbuyprice_withDiscount = '290' , productbuypricereal = '290' , buypricereal_precentage = '0' , buytotal_precentage = '3.1' , buyhalf_precentage = '3.1' , buypart_precentage = '3.1',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='290',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='290',meanbuyprice_withTax='290',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='290',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '573';
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', '573', '1.00', '2026-10-04', '1', '0','0057301','299','299','299','290','','0','0','0','0','0','0','0','0','0','0'); -- id=573
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('573', '1', '2', '1', '2026-10-04'); -- id=573
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('573', '1', '2', '0', '573', 'إضافة منتج', 'productController.php', '0', '2', '1', '2026-10-04','0','0'); -- id=3572
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (573, 1,'2026-10-04 21:15:10',1)
                ON DUPLICATE KEY UPDATE productid = 573, edited = 1, sysdate = '2026-10-04 21:15:10', userid = 1; -- id=732
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '580', '580', '2026-10-04', '1', '0', '0', '2026-10-04 21:15:10','إضافة منتج كشاف طوارئ ابيض  الكمية 2','1','0','0','0','573','productController.php?do=edit&id=573'); -- id=1304
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1304', '382', '580', '','0'); -- id=1310
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2481997.1', 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 ('1304', '121', '580', '','0'); -- id=1306
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1679196.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 = '290.00', productSellAllPrice = '299.00', productSellUnitPrice = '299.00', productSellHalfPrice = '299.00', productDate = '2026-10-04', conditions = '0', userId = '1', limitamount = '0', parcode = '00573',type ='0', expireDate = '0' , dailyentryId = '1304',isService = '0',isOptic = '0',lastbuyprice = '290',lastbuyprice_withDiscount = '290',meanbuyprice = '290',meanbuyprice_withDiscount = '290' , productbuypricereal = '290' , buypricereal_precentage = '0' , buytotal_precentage = '3.1' , buyhalf_precentage = '3.1' , buypart_precentage = '3.1',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='290',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='290',meanbuyprice_withTax='290',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='290',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '573';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:45:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:15:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:15:12', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3463
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('الحاج رفعت الجندي' , '', '', '', '0', '', '0', '2026-10-04 21:28:32', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-04','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=46
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('46', '0', '0', '', ''); -- id=46
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 ('46','0','0','0','إضافة عميل جديد','46', '0', '2026-10-04 21:28:32', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=364
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('الحاج رفعت الجندي', 'الحاج رفعت الجندي', 'الحاج رفعت الجندي', 'الحاج رفعت الجندي', '58', '0', '0', '0', '', '1', '1', '', '0', '3', '1', '', '1', '0', '2026-10-04 21:28:33'); -- id=479
UPDATE client SET clientname = 'الحاج رفعت الجندي', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-04', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='479',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='-1',datecustomeraccount='0000-00-00',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='0000-00-00 00:00:00' WHERE clientid = '46';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:59:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:29:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:29:24', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3464

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac2a5c178ead
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(46,@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,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-04 21:29:30', '06ac2a5c178ead', '46', '0.00', '31986', '0', '1', '61986.00', '61986', '30000', '31986', '1', '2026-10-04 21:29:30', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '854' ,'0','','','','','-1','0','0','0','0','0','61986','0','','0','0','30000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=220
UPDATE client SET  clientdebt = '31986', userid = '1' WHERE clientid = '46';
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 ('46','0.00','31986','0','اضافة فاتورة مبيعات','220', '31986', '2026-10-04 21:29:30', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '61986', '0', null, '0', null, null,'', '0','1','1','31986','1','2026-10-04 21:29:30','0','0','',''); -- id=365
UPDATE client SET  inUse = 0 where clientid = 46;
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', '220', '1', '1', '75', '54.78', '4108.5', '0', '', '1', '2026-10-04 21:29:31', '1', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.78','4108.5','0','','0','0.00','0','0','0','0'); -- id=1888
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 = 1888;
 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-04', 4108.5, 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+4108.5, 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-04', 4108.5, 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+4108.5, 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 = '351', userid = '1', storedetaildate = '2026-10-04 21:29:31' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '75', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '426', '351', '1', '2026-10-04 21:29:31','0','0'); -- id=3573
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', '220', '1', '4', '60', '36', '2160', '0', '', '1', '2026-10-04 21:29:31', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','2160','0','','0','0.00','0','0','0','0'); -- id=1889
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 = 1889;
 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-04', 2160, 2088, 2088
                    , 2088, 2088, 2088, 2088
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 2088, 2088, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2088
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2088, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2088
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2088, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2088
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2088
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2088
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2088
                        , returnSellVal = returnSellVal+0, 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+60
                        , 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-04', 2160, 2088, 2088
                    , 2088, 2088, 2088, 2088
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2088, 2088, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2088
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2088, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2088
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2088, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2088
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2088
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2088
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2088
                        , returnSellVal = returnSellVal+0, 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 = '1501', userid = '1', storedetaildate = '2026-10-04 21:29:31' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '60', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1561', '1501', '1', '2026-10-04 21:29:31','0','0'); -- id=3574
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', '220', '1', '12', '6', '66', '396', '0', '', '1', '2026-10-04 21:29:31', '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=1890
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 = 1890;
 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-04', 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-04', 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 = '47', userid = '1', storedetaildate = '2026-10-04 21:29:32' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '6', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '53', '47', '1', '2026-10-04 21:29:32','0','0'); -- id=3575
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 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', '220', '1', '10', '5', '246.5', '1232.5', '0', '', '1', '2026-10-04 21:29:32', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','69-5,','1','1','0','0','246.5','1232.5','0','','0','0.00','0','0','0','0'); -- id=1891
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 = 1891;
 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-04', 1232.5, 1185, 1185
                    , 1185, 1185, 1185, 1185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1185, 1185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1232.5, sellCostBuyPrice =sellCostBuyPrice+1185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1185
                        , returnSellVal = returnSellVal+0, 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-04', 1232.5, 1185, 1185
                    , 1185, 1185, 1185, 1185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1185, 1185, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1232.5, sellCostBuyPrice =sellCostBuyPrice+1185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1185
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1185
                        , returnSellVal = returnSellVal+0, 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-04 21:29:32' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '5', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '241', '236', '1', '2026-10-04 21:29:32','0','0'); -- id=3576
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', '220', '1', '15', '3', '170', '510', '0', '', '1', '2026-10-04 21:29:32', '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=1892
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 = 1892;
 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-04', 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-04', 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 = '99', userid = '1', storedetaildate = '2026-10-04 21:29:32' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '3', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '102', '99', '1', '2026-10-04 21:29:32','0','0'); -- id=3577
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', '220', '1', '3', '55', '36', '1980', '0', '', '1', '2026-10-04 21:29:32', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','1980','0','','0','0.00','0','0','0','0'); -- id=1893
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 = 1893;
 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-04', 1980, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 55, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, 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+55
                        , 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-04', 1980, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, 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 = '1257', userid = '1', storedetaildate = '2026-10-04 21:29:33' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '55', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1312', '1257', '1', '2026-10-04 21:29:33','0','0'); -- id=3578
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', '220', '1', '5', '80', '10.95', '876', '0', '', '1', '2026-10-04 21:29:33', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','876','0','','0','0.00','0','0','0','0'); -- id=1894
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 = 1894;
 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-04', 876, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+876, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, 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-04', 876, 844, 844
                    , 844, 844, 844, 844
                    , 0, 0, 0, 0
                    , 0, 0, 0, 844, 844, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+876, sellCostBuyPrice =sellCostBuyPrice+844
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+844, sellCostMeanBuyPrice = sellCostMeanBuyPrice+844
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+844, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+844
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+844
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+844
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+844
                        , returnSellVal = returnSellVal+0, 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 = '1092', userid = '1', storedetaildate = '2026-10-04 21:29:33' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '80', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1172', '1092', '1', '2026-10-04 21:29:33','0','0'); -- id=3579
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','00421', '220', '6', '421', '2', '90', '180', '0', '', '1', '2026-10-04 21:29:33', '421', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90','180','0','','0','0.00','0','0','0','0'); -- id=1895
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 = 1895;
 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 (421, '2026-10-04', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, 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-04', 180, 150, 150
                    , 150, 150, 150, 150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+150
                        , returnSellVal = returnSellVal+0, 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-04 21:29:33' WHERE storedetailid = '421';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '8', '1', '2026-10-04 21:29:33','0','0'); -- id=3580
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 67;
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','00016', '220', '1', '16', '6', '67', '402', '0', '', '1', '2026-10-04 21:29:34', '16', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','67-6,','1','1','0','0','67','402','0','','0','0.00','0','0','0','0'); -- id=1896
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 = 1896;
 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 (16, '2026-10-04', 402, 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+402, 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-04', 402, 378, 378
                    , 378, 378, 378, 378
                    , 0, 0, 0, 0
                    , 0, 0, 0, 378, 378, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+402, 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 = '82', userid = '1', storedetaildate = '2026-10-04 21:29:34' WHERE storedetailid = '16';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('16', '1', '6', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '88', '82', '1', '2026-10-04 21:29:34','0','0'); -- id=3581
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '220', '22', '160', '10', '140', '1400', '0', '', '1', '2026-10-04 21:29:34', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','73-10,','1','1','0','0','140','1400','0','','0','0.00','0','0','0','0'); -- id=1897
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 = 1897;
 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-04', 1400, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, 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+10
                        , 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-04', 1400, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1400, 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 = '93', userid = '1', storedetaildate = '2026-10-04 21:29:34' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '10', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '103', '93', '1', '2026-10-04 21:29:34','0','0'); -- id=3582
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+13 where id = 94;
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 ('270','00174', '220', '19', '174', '13', '275', '3575', '0', '', '1', '2026-10-04 21:29:34', '174', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','94-13,','1','1','0','0','275','3575','0','','0','0.00','0','0','0','0'); -- id=1898
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 1898;
 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 (174, '2026-10-04', 3575, 3510, 3510
                    , 3510, 3510, 3510, 3510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, 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+13
                        , 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-04', 3575, 3510, 3510
                    , 3510, 3510, 3510, 3510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, 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 = '41', userid = '1', storedetaildate = '2026-10-04 21:29:35' WHERE storedetailid = '174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('174', '1', '13', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '41', '1', '2026-10-04 21:29:35','0','0'); -- id=3583
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 95;
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 ('325','00175', '220', '19', '175', '3', '330', '990', '0', '', '1', '2026-10-04 21:29:35', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','95-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=1899
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 1899;
 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 (175, '2026-10-04', 990, 975, 975
                    , 975, 975, 975, 975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 975, 975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+975
                        , returnSellVal = returnSellVal+0, 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-04', 990, 975, 975
                    , 975, 975, 975, 975
                    , 0, 0, 0, 0
                    , 0, 0, 0, 975, 975, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+975
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+975, sellCostMeanBuyPrice = sellCostMeanBuyPrice+975
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+975, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+975
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+975
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+975
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+975
                        , returnSellVal = returnSellVal+0, 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-04 21:29:35' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '3', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '63', '1', '2026-10-04 21:29:35','0','0'); -- id=3584
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 51;
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.5','00451', '220', '6', '451', '100', '24.5', '2450', '0', '', '1', '2026-10-04 21:29:35', '451', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','51-100,','1','1','0','0','24.5','2450','0','','0','0.00','0','0','0','0'); -- id=1900
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 1900;
 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 (451, '2026-10-04', 2450, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2450, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, 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+100
                        , 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-04', 2450, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2450, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, 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-04 21:29:35' WHERE storedetailid = '451';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('451', '1', '100', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '0', '1', '2026-10-04 21:29:35','0','0'); -- id=3585
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','00207', '220', '6', '207', '15', '15', '225', '0', '', '1', '2026-10-04 21:29:35', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','225','0','','0','0.00','0','0','0','0'); -- id=1901
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 1901;
 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 (207, '2026-10-04', 225, 165, 165
                    , 165, 165, 165, 165
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 165, 165, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, 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+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-04', 225, 165, 165
                    , 165, 165, 165, 165
                    , 0, 0, 0, 0
                    , 0, 0, 0, 165, 165, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, 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 = '100', userid = '1', storedetaildate = '2026-10-04 21:29:36' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '15', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '115', '100', '1', '2026-10-04 21:29:36','0','0'); -- id=3586
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 ('60','00298', '220', '6', '298', '2', '75', '150', '0', '', '1', '2026-10-04 21:29:36', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','150','0','','0','0.00','0','0','0','0'); -- id=1902
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 1902;
 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 (298, '2026-10-04', 150, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, 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+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-04', 150, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, 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 = '6', userid = '1', storedetaildate = '2026-10-04 21:29:36' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '6', '1', '2026-10-04 21:29:36','0','0'); -- id=3587
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 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', '220', '1', '6', '7', '109', '763', '0', '', '1', '2026-10-04 21:29:36', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','62-7,','1','1','0','0','109','763','0','','0','0.00','0','0','0','0'); -- id=1903
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 = 1903;
 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-04', 763, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+763, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, 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-04', 763, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+763, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, 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 = '160', userid = '1', storedetaildate = '2026-10-04 21:29:36' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '7', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '167', '160', '1', '2026-10-04 21:29:36','0','0'); -- id=3588
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 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', '220', '1', '11', '8', '109', '872', '0', '', '1', '2026-10-04 21:29:36', '11', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','63-8,','1','1','0','0','109','872','0','','0','0.00','0','0','0','0'); -- id=1904
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 = 1904;
 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-04', 872, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+872, 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+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-04', 872, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+872, 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 = '114', userid = '1', storedetaildate = '2026-10-04 21:29:37' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '8', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '122', '114', '1', '2026-10-04 21:29:37','0','0'); -- id=3589
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+113 where id = 144;
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','00137', '220', '21', '137', '113', '17', '1921', '0', '', '1', '2026-10-04 21:29:37', '137', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','144-113,','1','1','0','0','17','1921','0','','0','0.00','0','0','0','0'); -- id=1905
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 = 1905;
 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 (137, '2026-10-04', 1921, 1819.3, 1819.3
                    , 1819.3, 1819.3, 1819.3, 1819.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 113, 0, 1819.3, 1819.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1921, sellCostBuyPrice =sellCostBuyPrice+1819.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1819.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1819.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1819.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1819.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1819.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1819.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1819.3
                        , returnSellVal = returnSellVal+0, 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+113
                        , 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-04', 1921, 1819.3, 1819.3
                    , 1819.3, 1819.3, 1819.3, 1819.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1819.3, 1819.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1921, sellCostBuyPrice =sellCostBuyPrice+1819.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1819.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1819.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1819.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1819.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1819.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1819.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1819.3
                        , returnSellVal = returnSellVal+0, 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 = '337', userid = '1', storedetaildate = '2026-10-04 21:29:37' WHERE storedetailid = '137';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('137', '1', '113', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '450', '337', '1', '2026-10-04 21:29:37','0','0'); -- id=3590
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', '220', '20', '187', '113', '48', '5424', '0', '', '1', '2026-10-04 21:29:37', '187', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','5424','0','','0','0.00','0','0','0','0'); -- id=1906
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 = 1906;
 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-04', 5424, 4664.64, 4664.64
                    , 4664.64, 4664.64, 4664.64, 4664.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 113, 0, 4664.64, 4664.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5424, sellCostBuyPrice =sellCostBuyPrice+4664.64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4664.64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4664.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4664.64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4664.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4664.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4664.64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4664.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+113
                        , 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-04', 5424, 4664.64, 4664.64
                    , 4664.64, 4664.64, 4664.64, 4664.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4664.64, 4664.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5424, sellCostBuyPrice =sellCostBuyPrice+4664.64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4664.64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4664.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4664.64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4664.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4664.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4664.64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4664.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 = '113', userid = '1', storedetaildate = '2026-10-04 21:29:37' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '113', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '226', '113', '1', '2026-10-04 21:29:37','0','0'); -- id=3591
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 ('106','00110', '220', '3', '110', '4', '110', '440', '0', '', '1', '2026-10-04 21:29:37', '110', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','110','440','0','','0','0.00','0','0','0','0'); -- id=1907
UPDATE sellbilldetail SET  lastbuyprice = 106.00 , meanbuyprice = 106.00, lastbuyprice_withDiscount = 106.00, meanbuyprice_withDiscount = 106.00
        , lastbuyprice_withTax = 106, meanbuyprice_withTax = 106, lastbuyprice_withDiscountAndTax = 106
                where sellbilldetailid = 1907;
 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 (110, '2026-10-04', 440, 424, 424
                    , 424, 424, 424, 424
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 424, 424, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+424
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+424, sellCostMeanBuyPrice = sellCostMeanBuyPrice+424
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+424, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+424
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+424
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+424
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+424
                        , returnSellVal = returnSellVal+0, 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-04', 440, 424, 424
                    , 424, 424, 424, 424
                    , 0, 0, 0, 0
                    , 0, 0, 0, 424, 424, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+424
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+424, sellCostMeanBuyPrice = sellCostMeanBuyPrice+424
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+424, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+424
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+424
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+424
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+424
                        , returnSellVal = returnSellVal+0, 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 = '12', userid = '1', storedetaildate = '2026-10-04 21:29:38' WHERE storedetailid = '110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '1', '4', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '12', '1', '2026-10-04 21:29:38','0','0'); -- id=3592
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', '220', '3', '108', '8', '103', '824', '0', '', '1', '2026-10-04 21:29:38', '108', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','103','824','0','','0','0.00','0','0','0','0'); -- id=1908
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 = 1908;
 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-04', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+824, sellCostBuyPrice =sellCostBuyPrice+808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+808, sellCostMeanBuyPrice = sellCostMeanBuyPrice+808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+808
                        , returnSellVal = returnSellVal+0, 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-04', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+824, sellCostBuyPrice =sellCostBuyPrice+808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+808, sellCostMeanBuyPrice = sellCostMeanBuyPrice+808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+808
                        , returnSellVal = returnSellVal+0, 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 = '12', userid = '1', storedetaildate = '2026-10-04 21:29:38' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '8', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '12', '1', '2026-10-04 21:29:38','0','0'); -- id=3593
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', '220', '3', '111', '4', '120', '480', '0', '', '1', '2026-10-04 21:29:38', '111', '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=1909
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 = 1909;
 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-04', 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-04', 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 = '17', userid = '1', storedetaildate = '2026-10-04 21:29:38' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '4', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '17', '1', '2026-10-04 21:29:38','0','0'); -- id=3594
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','00109', '220', '3', '109', '2', '103', '206', '0', '', '1', '2026-10-04 21:29:39', '109', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','103','206','0','','0','0.00','0','0','0','0'); -- id=1910
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 = 1910;
 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 (109, '2026-10-04', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, 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-04', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, 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-04 21:29:39' WHERE storedetailid = '109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '30', '1', '2026-10-04 21:29:39','0','0'); -- id=3595
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+14 where id = 23;
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','00107', '220', '3', '107', '14', '103', '1442', '0', '', '1', '2026-10-04 21:29:39', '107', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','23-14,','1','1','0','0','103','1442','0','','0','0.00','0','0','0','0'); -- id=1911
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 = 1911;
 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 (107, '2026-10-04', 1442, 1414, 1414
                    , 1414, 1414, 1414, 1414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14, 0, 1414, 1414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1442, sellCostBuyPrice =sellCostBuyPrice+1414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1414
                        , returnSellVal = returnSellVal+0, 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+14
                        , 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-04', 1442, 1414, 1414
                    , 1414, 1414, 1414, 1414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1414, 1414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1442, sellCostBuyPrice =sellCostBuyPrice+1414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1414
                        , returnSellVal = returnSellVal+0, 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-04 21:29:39' WHERE storedetailid = '107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '1', '14', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '73', '59', '1', '2026-10-04 21:29:39','0','0'); -- id=3596
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', '220', '3', '102', '50', '12', '600', '0', '', '1', '2026-10-04 21:29:39', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','600','0','','0','0.00','0','0','0','0'); -- id=1912
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 = 1912;
 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-04', 600, 587.5, 587.5
                    , 587.5, 587.5, 587.5, 587.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 587.5, 587.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+587.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+587.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+587.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+587.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+587.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+587.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+587.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+587.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+50
                        , 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-04', 600, 587.5, 587.5
                    , 587.5, 587.5, 587.5, 587.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 587.5, 587.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+587.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+587.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+587.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+587.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+587.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+587.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+587.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+587.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 = '870', userid = '1', storedetaildate = '2026-10-04 21:29:39' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '50', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '920', '870', '1', '2026-10-04 21:29:40','0','0'); -- id=3597
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 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', '220', '3', '103', '50', '5.5', '275', '0', '', '1', '2026-10-04 21:29:40', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-50,','1','1','0','0','5.5','275','0','','0','0.00','0','0','0','0'); -- id=1913
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 = 1913;
 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-04', 275, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, 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+50
                        , 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-04', 275, 225, 225
                    , 225, 225, 225, 225
                    , 0, 0, 0, 0
                    , 0, 0, 0, 225, 225, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, 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 = '1268', userid = '1', storedetaildate = '2026-10-04 21:29:40' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '50', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1318', '1268', '1', '2026-10-04 21:29:40','0','0'); -- id=3598
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 86;
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 ('234.1','00122', '220', '3', '122', '2', '245', '490', '0', '', '1', '2026-10-04 21:29:40', '122', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','86-2,','1','1','0','0','245','490','0','','0','0.00','0','0','0','0'); -- id=1914
UPDATE sellbilldetail SET  lastbuyprice = 234.10 , meanbuyprice = 236.88, lastbuyprice_withDiscount = 234.10, meanbuyprice_withDiscount = 236.88
        , lastbuyprice_withTax = 234.1, meanbuyprice_withTax = 236.88, lastbuyprice_withDiscountAndTax = 234.1
                where sellbilldetailid = 1914;
 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 (122, '2026-10-04', 490, 468.2, 468.2
                    , 473.76, 468.2, 473.76, 468.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 468.2, 473.76, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+490, sellCostBuyPrice =sellCostBuyPrice+468.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+468.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+473.76
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+468.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+473.76
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+468.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+468.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+473.76
                        , returnSellVal = returnSellVal+0, 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-04', 490, 468.2, 468.2
                    , 473.76, 468.2, 473.76, 468.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 468.2, 473.76, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+490, sellCostBuyPrice =sellCostBuyPrice+468.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+468.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+473.76
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+468.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+473.76
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+468.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+468.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+473.76
                        , returnSellVal = returnSellVal+0, 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-04 21:29:40' WHERE storedetailid = '122';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('122', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '9', '1', '2026-10-04 21:29:40','0','0'); -- id=3599
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 22;
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 ('78.4','00386', '220', '3', '386', '3', '82.5', '247.5', '0', '', '1', '2026-10-04 21:29:40', '386', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','22-3,','1','1','0','0','82.5','247.5','0','','0','0.00','0','0','0','0'); -- id=1915
UPDATE sellbilldetail SET  lastbuyprice = 78.40 , meanbuyprice = 78.40, lastbuyprice_withDiscount = 78.40, meanbuyprice_withDiscount = 78.40
        , lastbuyprice_withTax = 78.4, meanbuyprice_withTax = 78.4, lastbuyprice_withDiscountAndTax = 78.4
                where sellbilldetailid = 1915;
 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 (386, '2026-10-04', 247.5, 235.2, 235.2
                    , 235.2, 235.2, 235.2, 235.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 235.2, 235.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.5, sellCostBuyPrice =sellCostBuyPrice+235.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+235.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+235.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+235.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+235.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+235.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+235.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+235.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-04', 247.5, 235.2, 235.2
                    , 235.2, 235.2, 235.2, 235.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 235.2, 235.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.5, sellCostBuyPrice =sellCostBuyPrice+235.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+235.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+235.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+235.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+235.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+235.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+235.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+235.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 = '39', userid = '1', storedetaildate = '2026-10-04 21:29:41' WHERE storedetailid = '386';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '1', '3', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '39', '1', '2026-10-04 21:29:41','0','0'); -- id=3600
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', '220', '3', '117', '4', '39', '156', '0', '', '1', '2026-10-04 21:29:41', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','156','0','','0','0.00','0','0','0','0'); -- id=1916
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 = 1916;
 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04', 156, 148, 148
                    , 148, 148, 148, 148
                    , 0, 0, 0, 0
                    , 0, 0, 0, 148, 148, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+148
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+148, sellCostMeanBuyPrice = sellCostMeanBuyPrice+148
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+148, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+148
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+148
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+148
                        , returnSellVal = returnSellVal+0, 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-04 21:29:41' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '4', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '17', '1', '2026-10-04 21:29:41','0','0'); -- id=3601
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 ('1920','00571', '220', '6', '571', '5', '1980', '9900', '0', '', '1', '2026-10-04 21:29:41', '571', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1980','9900','0','','0','0.00','0','0','0','0'); -- id=1917
UPDATE sellbilldetail SET  lastbuyprice = 1920.00 , meanbuyprice = 1920.00, lastbuyprice_withDiscount = 1920.00, meanbuyprice_withDiscount = 1920.00
        , lastbuyprice_withTax = 1920, meanbuyprice_withTax = 1920, lastbuyprice_withDiscountAndTax = 1920
                where sellbilldetailid = 1917;
 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 (571, '2026-10-04', 9900, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9900, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, 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-04', 9900, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9900, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, 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-04 21:29:41' WHERE storedetailid = '571';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('571', '1', '5', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '1', '2026-10-04 21:29:41','0','0'); -- id=3602
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 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', '220', '3', '116', '8', '56', '448', '0', '', '1', '2026-10-04 21:29:41', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','88-8,','1','1','0','0','56','448','0','','0','0.00','0','0','0','0'); -- id=1918
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 = 1918;
 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-04', 448, 414.16, 414.16
                    , 415.68, 414.16, 415.68, 414.16
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 414.16, 415.68, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+448, sellCostBuyPrice =sellCostBuyPrice+414.16
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414.16, sellCostMeanBuyPrice = sellCostMeanBuyPrice+415.68
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+415.68
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414.16
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+415.68
                        , returnSellVal = returnSellVal+0, 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-04', 448, 414.16, 414.16
                    , 415.68, 414.16, 415.68, 414.16
                    , 0, 0, 0, 0
                    , 0, 0, 0, 414.16, 415.68, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+448, sellCostBuyPrice =sellCostBuyPrice+414.16
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414.16, sellCostMeanBuyPrice = sellCostMeanBuyPrice+415.68
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414.16, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+415.68
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414.16
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414.16
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+415.68
                        , returnSellVal = returnSellVal+0, 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-04 21:29:42' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '8', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '44', '1', '2026-10-04 21:29:42','0','0'); -- id=3603
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 89;
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 ('85.97','00115', '220', '3', '115', '5', '90.5', '452.5', '0', '', '1', '2026-10-04 21:29:42', '115', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','89-5,','1','1','0','0','90.5','452.5','0','','0','0.00','0','0','0','0'); -- id=1919
UPDATE sellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where sellbilldetailid = 1919;
 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 (115, '2026-10-04', 452.5, 429.85, 429.85
                    , 436.45, 429.85, 436.45, 429.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 429.85, 436.45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+452.5, sellCostBuyPrice =sellCostBuyPrice+429.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+429.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+436.45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+429.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+436.45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+429.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+429.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+436.45
                        , returnSellVal = returnSellVal+0, 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-04', 452.5, 429.85, 429.85
                    , 436.45, 429.85, 436.45, 429.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 429.85, 436.45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+452.5, sellCostBuyPrice =sellCostBuyPrice+429.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+429.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+436.45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+429.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+436.45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+429.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+429.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+436.45
                        , returnSellVal = returnSellVal+0, 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 = '40', userid = '1', storedetaildate = '2026-10-04 21:29:42' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '5', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '40', '1', '2026-10-04 21:29:42','0','0'); -- id=3604
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 ('450','00572', '220', '19', '572', '2', '475', '950', '0', '', '1', '2026-10-04 21:29:42', '572', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','475','950','0','','0','0.00','0','0','0','0'); -- id=1920
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 1920;
 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 (572, '2026-10-04', 950, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, 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-04', 950, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+950, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, 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-04 21:29:42' WHERE storedetailid = '572';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('572', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '0', '1', '2026-10-04 21:29:42','0','0'); -- id=3605
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 ('912','00068', '220', '6', '68', '4', '920', '3680', '0', '', '1', '2026-10-04 21:29:42', '68', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','920','3680','0','','0','0.00','0','0','0','0'); -- id=1921
UPDATE sellbilldetail SET  lastbuyprice = 912.00 , meanbuyprice = 912.00, lastbuyprice_withDiscount = 912.00, meanbuyprice_withDiscount = 912.00
        , lastbuyprice_withTax = 912, meanbuyprice_withTax = 912, lastbuyprice_withDiscountAndTax = 912
                where sellbilldetailid = 1921;
 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 (68, '2026-10-04', 3680, 3648, 3648
                    , 3648, 3648, 3648, 3648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3648, 3648, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3680, sellCostBuyPrice =sellCostBuyPrice+3648
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3648, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3648
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3648
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3648
                        , returnSellVal = returnSellVal+0, 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-04', 3680, 3648, 3648
                    , 3648, 3648, 3648, 3648
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3648, 3648, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3680, sellCostBuyPrice =sellCostBuyPrice+3648
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3648, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3648
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3648, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3648
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3648
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3648
                        , returnSellVal = returnSellVal+0, 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-04 21:29:43' WHERE storedetailid = '68';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('68', '1', '4', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7', '3', '1', '2026-10-04 21:29:43','0','0'); -- id=3606
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 ('460','00562', '220', '10', '562', '1', '525', '525', '0', '', '1', '2026-10-04 21:29:43', '562', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','525','525','0','','0','0.00','0','0','0','0'); -- id=1922
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 1922;
 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 (562, '2026-10-04', 525, 460, 460
                    , 460, 460, 460, 460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 460, 460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+525, sellCostBuyPrice =sellCostBuyPrice+460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+460
                        , returnSellVal = returnSellVal+0, 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-04', 525, 460, 460
                    , 460, 460, 460, 460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 460, 460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+525, sellCostBuyPrice =sellCostBuyPrice+460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+460
                        , returnSellVal = returnSellVal+0, 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-04 21:29:43' WHERE storedetailid = '562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '1', '1', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-10-04 21:29:43','0','0'); -- id=3607
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 ('2150','00570', '220', '16', '570', '1', '2400', '2400', '0', '', '1', '2026-10-04 21:29:43', '570', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2400','2400','0','','0','0.00','0','0','0','0'); -- id=1923
UPDATE sellbilldetail SET  lastbuyprice = 2150.00 , meanbuyprice = 2150.00, lastbuyprice_withDiscount = 2150.00, meanbuyprice_withDiscount = 2150.00
        , lastbuyprice_withTax = 2150, meanbuyprice_withTax = 2150, lastbuyprice_withDiscountAndTax = 2150
                where sellbilldetailid = 1923;
 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 (570, '2026-10-04', 2400, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, 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-04', 2400, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, 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-04 21:29:44' WHERE storedetailid = '570';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('570', '1', '1', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-04 21:29:44','0','0'); -- id=3608
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','00402', '220', '16', '402', '2', '2050', '4100', '0', '', '1', '2026-10-04 21:29:44', '402', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2050','4100','0','','0','0.00','0','0','0','0'); -- id=1924
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 = 1924;
 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 (402, '2026-10-04', 4100, 3500, 3500
                    , 3500, 3500, 3500, 3500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 3500, 3500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3500
                        , returnSellVal = returnSellVal+0, 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-04', 4100, 3500, 3500
                    , 3500, 3500, 3500, 3500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3500, 3500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3500
                        , returnSellVal = returnSellVal+0, 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-04 21:29:44' WHERE storedetailid = '402';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '1', '2', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '1', '1', '2026-10-04 21:29:44','0','0'); -- id=3609
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 ('450','00425', '220', '16', '425', '3', '595', '1785', '0', '', '1', '2026-10-04 21:29:44', '425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','595','1785','0','','0','0.00','0','0','0','0'); -- id=1925
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 1925;
 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 (425, '2026-10-04', 1785, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1785, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, 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-04', 1785, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1785, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, 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-04 21:29:44' WHERE storedetailid = '425';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('425', '1', '3', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '-1', '1', '2026-10-04 21:29:44','0','0'); -- id=3610
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 ('450','00518', '220', '16', '518', '6', '495', '2970', '0', '', '1', '2026-10-04 21:29:44', '518', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','495','2970','0','','0','0.00','0','0','0','0'); -- id=1926
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 1926;
 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 (518, '2026-10-04', 2970, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, 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-04', 2970, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, 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-04 21:29:45' WHERE storedetailid = '518';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '1', '6', '1', '220', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '5', '1', '2026-10-04 21:29:45','0','0'); -- id=3611
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-418666.90625',  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 ('-448666.90625','30000', '0', '1', 'اضافة فاتورة مبيعات', '220', '-418666.90625', '2026-10-04 21:29:45', '1',  'sellbillController.php','46','','0'); -- id=218
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '61986', '61986', '2026-10-04', '1', '0', '0', '2026-10-04 21:29:45','اضافة فاتورة مبيعات رقم 220','1','0',null,'0','220','sellbillController.php?do=showDetail&sellbillid=220'); -- id=1305
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1305', '479', '61986', '','0'); -- id=1311
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '61986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1305', '143', '61986', '','0'); -- id=1307
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '997577.63', 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 ( '30000', '30000', '2026-10-04', '1', '0', '0', '2026-10-04 21:29:45','اضافة فاتورة مبيعات رقم 220 - تحصيل الفاتورة من العميل','1','0',null,'0','220','sellbillController.php?do=showDetail&sellbillid=220'); -- id=1306
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1306', '383', '30000', '','0'); -- id=1312
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-163224.88', 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 ('1306', '479', '30000', '','0'); -- id=1308
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '31986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '57689.1', '57689.1', '2026-10-04', '1', '0', '0', '2026-10-04 21:29:45','اضافة فاتورة مبيعات رقم 220 - صرف البضاعة من المخزن','1','0',null,'0','220','sellbillController.php?do=showDetail&sellbillid=220'); -- id=1307
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1307', '402', '57689.1', '','0'); -- id=1313
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '904969.59', 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 ('1307', '382', '57689.1', '','0'); -- id=1309
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2424308', 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='1305,1306,1307' where sellbillid=220;
 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-04', 61986, 57689.1, 57689.1
                    , 57702.78, 57689.1, 57702.78, 57689.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,57689.1, 57702.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+61986, sellCostBuyPrice =sellCostBuyPrice+57689.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+57689.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+57702.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+57689.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+57702.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+57689.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+57689.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+57702.78
                        , returnSellVal = returnSellVal+0, 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 (46, '2026-10-04', 61986, 57689.1, 57689.1
                    , 57702.78, 57689.1, 57702.78, 57689.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,57689.1, 57702.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+61986, sellCostBuyPrice =sellCostBuyPrice+57689.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+57689.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+57702.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+57689.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+57702.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+57689.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+57689.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+57702.78
                        , returnSellVal = returnSellVal+0, 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, 61986, 57689.1, 57689.1
                    , 57702.78, 57689.1, 57702.78, 57689.1, 57689.1, 57702.78)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+61986, netSellCostBuyPrice = netSellCostBuyPrice+57689.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+57689.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+57702.78
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+57689.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+57702.78
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+57689.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+57689.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+57702.78;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac2a5c178ead and sellbillId = 220 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 17:59:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:29:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:29:48', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:07:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:37:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:37:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=3466
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:08:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:38:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:38:15', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:08:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:38:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:38:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3468
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:08:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:38:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:38:36', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3469
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:08:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:38:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:38:43', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=189'); -- id=3470
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:09:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:39:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:39:20', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3471
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 189;
UPDATE sellbill SET  sellbillsysdate = '2026-10-04 21:39:21', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '189';
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 = 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-04', 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-04', 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-04 21:39:21' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '70', '78', '1', '2026-09-26 16:55:00','0','0'); -- id=3612
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-04', 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-04', 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-04 21:39:21' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '681', '697', '1', '2026-09-26 16:55:00','0','0'); -- id=3613
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-04', 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-04', 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-04 21:39:21' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '855', '870', '1', '2026-09-26 16:55:00','0','0'); -- id=3614
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-04', 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-04', 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-04 21:39:21' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=3615
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-04', 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-04', 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-04 21:39:22' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=3616
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-04', 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-04', 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-04 21:39:22' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3617
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-04', 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-04', 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-04 21:39:22' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3618
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-04', 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-04', 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 = '18', userid = '1', storedetaildate = '2026-10-04 21:39:22' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '18', '1', '2026-09-26 16:55:00','0','0'); -- id=3619
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-04', 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-04', 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-04 21:39:22' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '44', '1', '2026-09-26 16:55:00','0','0'); -- id=3620
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-04', 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-04', 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 = '119', userid = '1', storedetaildate = '2026-10-04 21:39:22' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '15', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '104', '119', '1', '2026-09-26 16:55:00','0','0'); -- id=3621
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 = 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-04', 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-04', 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 = '24', userid = '1', storedetaildate = '2026-10-04 21:39:22' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '12', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '24', '1', '2026-09-26 16:55:00','0','0'); -- id=3622
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-04', 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-04', 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 = '23', userid = '1', storedetaildate = '2026-10-04 21:39:22' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '6', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '23', '1', '2026-09-26 16:55:00','0','0'); -- id=3623
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-04', 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-04', 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-04 21:39:22' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '4', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=3624
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 = 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-04', 45, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52.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-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-04', 45, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52.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 = '53', userid = '1', storedetaildate = '2026-10-04 21:39:23' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '3', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '50', '53', '1', '2026-09-26 16:55:00','0','0'); -- id=3625
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 = 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-04', 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-04', 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-04 21:39:23' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '2', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '30', '1', '2026-09-26 16:55:00','0','0'); -- id=3626
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-04', 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-04', 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-04 21:39:23' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '1', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '25', '1', '2026-09-26 16:55:00','0','0'); -- id=3627
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-04', 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-04', 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-04 21:39:23' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '2', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '207', '209', '1', '2026-09-26 16:55:00','0','0'); -- id=3628
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-04', 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-04', 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-04 21:39:23' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '6', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '239', '245', '1', '2026-09-26 16:55:00','0','0'); -- id=3629
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-04', 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-04', 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 = '21', userid = '1', storedetaildate = '2026-10-04 21:39:23' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '5', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '21', '1', '2026-09-26 16:55:00','0','0'); -- id=3630
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-04', 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-04', 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 = '125', userid = '1', storedetaildate = '2026-10-04 21:39:23' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '6', '0', '189', 'تعديل فاتورة مبيعات', 'sellbillController.php', '119', '125', '1', '2026-09-26 16:55:00','0','0'); -- id=3631
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','7151.10','23420.00','1','تعديل فاتورة مبيعات','189', '-16268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '23420', '0', null, '0', null, null,'', '0','1','1','23420','1','2026-09-26 16:55:00','0','0','',''); -- id=366
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-04', 23420, 20853.92, 20853.92
                    , 20781.92, 20853.92, 20781.92, 20853.92
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20853.92, 20781.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23420, sellCostBuyPrice =sellCostBuyPrice-20853.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20853.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20781.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20853.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20781.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20853.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20853.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20781.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;
 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-04', 23420, 20853.92, 20853.92
                    , 20781.92, 20853.92, 20781.92, 20853.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20853.92, 20781.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23420, sellCostBuyPrice =sellCostBuyPrice-20853.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20853.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20781.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20853.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20781.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20853.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20853.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20781.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 23420, 20853.92, 20853.92
                    , 20781.92, 20853.92, 20781.92, 20853.92, 20853.92, 20781.92)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-23420, netSellCostBuyPrice = netSellCostBuyPrice-20853.92
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-20853.92
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-20781.92
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-20853.92
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-20781.92
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-20853.92
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-20853.92
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-20781.92;

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


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 189 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', '7232.1', '0', '1', '23501', '23501', '0', '23501', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '157', '189', '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=221
UPDATE client SET  clientdebt = '7232.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','23501','0','اضافة فاتورة مبيعات (معدله)','221', '7232.1', '2026-10-04 21:39:24', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '23501', '0', null, '0', null, null,'', '0','1','1','23420','1','2026-09-26 16:55:00','0','0','',''); -- id=367
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', '221', '10', '208', '8.00', '1210', '9680', '0', '', '1', '2026-10-04 21:39:24', '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=1927
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 = 1927;
 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-04', 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-04', 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-04 21:39:24' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '78', '70', '1', '2026-10-04 21:39:25','0','0'); -- id=3632
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', '221', '6', '315', '18', '8', '144', '0', '', '1', '2026-10-04 21:39:25', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','144','0','','0','0.00','0','0','0','0'); -- id=1928
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 = 1928;
 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-04', 144, 117, 117
                    , 117, 117, 117, 117
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 117, 117, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+144, sellCostBuyPrice =sellCostBuyPrice+117
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+117, sellCostMeanBuyPrice = sellCostMeanBuyPrice+117
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+117, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+117
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+117
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+117
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+117
                        , returnSellVal = returnSellVal+0, 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+18
                        , 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-04', 144, 117, 117
                    , 117, 117, 117, 117
                    , 0, 0, 0, 0
                    , 0, 0, 0, 117, 117, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+144, sellCostBuyPrice =sellCostBuyPrice+117
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+117, sellCostMeanBuyPrice = sellCostMeanBuyPrice+117
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+117, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+117
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+117
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+117
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+117
                        , returnSellVal = returnSellVal+0, 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 = '679', userid = '1', storedetaildate = '2026-10-04 21:39:25' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '18', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '697', '679', '1', '2026-10-04 21:39:25','0','0'); -- id=3633
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', '221', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-10-04 21:39:25', '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=1929
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 = 1929;
 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-04', 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-04', 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-04 21:39:25' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '870', '855', '1', '2026-10-04 21:39:25','0','0'); -- id=3634
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', '221', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-10-04 21:39:25', '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=1930
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 = 1930;
 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-04', 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-04', 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-04 21:39:26' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-10-04 21:39:26','0','0'); -- id=3635
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', '221', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-10-04 21:39:26', '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=1931
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 = 1931;
 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-04', 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-04', 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-04 21:39:26' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-10-04 21:39:26','0','0'); -- id=3636
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', '221', '6', '530', '1.00', '10', '10', '0', '', '1', '2026-10-04 21:39:26', '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=1932
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 = 1932;
 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-04', 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-04', 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-04 21:39:26' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-10-04 21:39:26','0','0'); -- id=3637
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', '221', '6', '529', '3.00', '26', '78', '0', '', '1', '2026-10-04 21:39:26', '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=1933
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 = 1933;
 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-04', 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-04', 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-04 21:39:27' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '17', '1', '2026-10-04 21:39:27','0','0'); -- id=3638
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', '221', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-10-04 21:39:27', '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=1934
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 = 1934;
 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-04', 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-04', 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 = '17', userid = '1', storedetaildate = '2026-10-04 21:39:27' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '17', '1', '2026-10-04 21:39:27','0','0'); -- id=3639
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', '221', '10', '531', '44.00', '175', '7700', '0', '', '1', '2026-10-04 21:39:27', '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=1935
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 = 1935;
 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-04', 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-04', 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-04 21:39:27' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '0', '1', '2026-10-04 21:39:27','0','0'); -- id=3640
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', '221', '10', '2', '15.00', '88', '1320', '0', '', '1', '2026-10-04 21:39:27', '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=1936
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 = 1936;
 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-04', 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-04', 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-04 21:39:28' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '15', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '110', '1', '2026-10-04 21:39:28','0','0'); -- id=3641
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', '221', '3', '108', '12.00', '103', '1236', '0', '', '1', '2026-10-04 21:39:28', '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=1937
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 = 1937;
 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-04', 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-04', 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 = '12', userid = '1', storedetaildate = '2026-10-04 21:39:28' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '12', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '12', '1', '2026-10-04 21:39:28','0','0'); -- id=3642
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', '221', '3', '111', '6.00', '120', '720', '0', '', '1', '2026-10-04 21:39:28', '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=1938
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 = 1938;
 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-04', 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-04', 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 = '17', userid = '1', storedetaildate = '2026-10-04 21:39:28' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '6', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '23', '17', '1', '2026-10-04 21:39:28','0','0'); -- id=3643
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', '221', '3', '112', '4.00', '120', '480', '0', '', '1', '2026-10-04 21:39:28', '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=1939
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 = 1939;
 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-04', 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-04', 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-04 21:39:29' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '4', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '16', '1', '2026-10-04 21:39:29','0','0'); -- id=3644
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 139;
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','00450', '221', '6', '450', '3.00', '15', '45', '0', '', '1', '2026-10-04 21:39:29', '450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','139-3,','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=1940
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 = 1940;
 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-04', 45, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52.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+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-04', 45, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52.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 = '50', userid = '1', storedetaildate = '2026-10-04 21:39:29' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '3', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '53', '50', '1', '2026-10-04 21:39:29','0','0'); -- id=3645
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 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', '221', '6', '344', '3', '15', '45', '0', '', '1', '2026-10-04 21:39:29', '344', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','34-3,','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=1941
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 = 1941;
 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-04', 45, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, 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+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-04', 45, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, 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 = '27', userid = '1', storedetaildate = '2026-10-04 21:39:29' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '3', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-10-04 21:39:29','0','0'); -- id=3646
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', '221', '6', '343', '1.00', '40', '40', '0', '', '1', '2026-10-04 21:39:29', '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=1942
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 = 1942;
 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-04', 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-04', 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-04 21:39:30' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '1', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '24', '1', '2026-10-04 21:39:30','0','0'); -- id=3647
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', '221', '12', '440', '2.00', '36', '72', '0', '', '1', '2026-10-04 21:39:30', '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=1943
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 = 1943;
 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-04', 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-04', 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-04 21:39:30' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '2', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '209', '207', '1', '2026-10-04 21:39:30','0','0'); -- id=3648
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', '221', '12', '446', '6.00', '5', '30', '0', '', '1', '2026-10-04 21:39:30', '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=1944
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 = 1944;
 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-04', 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-04', 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-04 21:39:30' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '6', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '245', '239', '1', '2026-10-04 21:39:30','0','0'); -- id=3649
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', '221', '6', '525', '5.00', '23', '115', '0', '', '1', '2026-10-04 21:39:31', '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=1945
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 = 1945;
 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-04', 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-04', 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 = '16', userid = '1', storedetaildate = '2026-10-04 21:39:31' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '5', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '21', '16', '1', '2026-10-04 21:39:31','0','0'); -- id=3650
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', '221', '10', '2', '6.00', '88', '528', '0', '', '1', '2026-10-04 21:39:31', '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=1946
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 = 1946;
 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-04', 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-04', 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-04 21:39:31' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '6', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '110', '104', '1', '2026-10-04 21:39:31','0','0'); -- id=3651
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 ('45','00377', '221', '6', '377', '1', '50', '50', '0', '', '1', '2026-10-04 21:39:31', '377', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','50','50','0','','0','0.00','0','0','0','0'); -- id=1947
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 1947;
 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 (377, '2026-10-04', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, 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-04', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, 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-04 21:39:31' WHERE storedetailid = '377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('377', '1', '1', '1', '221', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-10-04 21:39:31','0','0'); -- id=3652
UPDATE dailyentry SET totalcreditor = '23420.00', totaldebtor = '23420.00', thedate = '2026-10-02', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-02 15:47:21', entryComment = 'اضافة فاتورة مبيعات رقم 189', fromFlag = '1',related='0',isopeningentry='0',operationId='189',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=189' WHERE id = '1204';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23420.00', '23420.00', '2026-10-04', '1', '0', '1204', '2026-10-04 21:39:32','تم عكس القيد رقم 1204 ','1','0','0','0','0',''); -- id=1308
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1308', '430', '23420.00', '','0'); -- id=1310
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 ('1308', '143', '23420.00', '','0'); -- id=1314
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '974157.63', 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 = '20840.12', totaldebtor = '20840.12', thedate = '2026-10-02', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-02 15:47:21', entryComment = 'اضافة فاتورة مبيعات رقم 189 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='189',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=189' WHERE id = '1205';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20840.12', '20840.12', '2026-10-04', '1', '0', '1205', '2026-10-04 21:39:32','تم عكس القيد رقم 1205 ','1','0','0','0','0',''); -- id=1309
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1309', '402', '20840.12', '','0'); -- id=1311
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '884129.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1309', '382', '20840.12', '','0'); -- id=1315
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2445148.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 dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23501', '23501', '2026-10-04', '1', '0', '0', '2026-10-04 21:39:33','اضافة فاتورة مبيعات رقم 221','1','0',null,'0','221','sellbillController.php?do=showDetail&sellbillid=221'); -- id=1310
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1310', '430', '23501', '','0'); -- id=1316
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '7232.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 ('1310', '143', '23501', '','0'); -- id=1312
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '997658.63', 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 ( '20923.92', '20923.92', '2026-10-04', '1', '0', '0', '2026-10-04 21:39:33','اضافة فاتورة مبيعات رقم 221 - صرف البضاعة من المخزن','1','0',null,'0','221','sellbillController.php?do=showDetail&sellbillid=221'); -- id=1311
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1311', '402', '20923.92', '','0'); -- id=1317
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '905053.39', 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 ('1311', '382', '20923.92', '','0'); -- id=1313
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2424224.2', 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='1310,0,1311' where sellbillid=221;
 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-04', 23501, 20923.92, 20923.92
                    , 20851.92, 20923.92, 20851.92, 20923.92
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20923.92, 20851.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23501, sellCostBuyPrice =sellCostBuyPrice+20923.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20923.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20851.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20923.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20851.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20923.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20923.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20851.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;
 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-04', 23501, 20923.92, 20923.92
                    , 20851.92, 20923.92, 20851.92, 20923.92
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20923.92, 20851.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23501, sellCostBuyPrice =sellCostBuyPrice+20923.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20923.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20851.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20923.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20851.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20923.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20923.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20851.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 23501, 20923.92, 20923.92
                    , 20851.92, 20923.92, 20851.92, 20923.92, 20923.92, 20851.92)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+23501, netSellCostBuyPrice = netSellCostBuyPrice+20923.92
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20923.92
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20851.92
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20923.92
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20851.92
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20923.92
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+20923.92
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+20851.92;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:09:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:39:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:39:34', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=221'); -- id=3472
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:09:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:39:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-04 21:39:42', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=3473
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:09:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:39:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:39:47', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:09:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:39:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:39:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=3475
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:12:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:42:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:42:50', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3476

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac2ab86a046b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(5,@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-04 21:42:50', '06ac2ab86a046b', '5', '7232.10', '6793.8', '0', '1', '438.3', '438.3', '0', '-438.3', '1', '2026-10-04 21:42:50', '', '1', '0', 'احمد عبدالحميد حسون ','1', '1', '5', '0', 'احمد عبدالحميد حسون ', '17', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=13
UPDATE client SET  clientdebt = '6793.8', 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','7232.10','438.3','1','اضافة فاتورة مردوات مبيعات','13', '6793.8', '2026-10-04 21:42:51', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '438.3', '0', null, '0', null, null,'', '0','1','1','438.3','1','2026-10-04 21:42:50','0','0','',''); -- id=368
UPDATE client SET  inUse = 0 where clientid = 5;
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 ('116.00', '00111', '13', '3', '111', '2', '120', '240', '0', '', '1', '0', '111', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','120','240','0','','0'); -- id=55
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 55;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 240, 232, 232, 232
                    , 232, 232, 232, 0, 2, 0, 0, 232, 232)
                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+240, returnSellCostBuyPrice = returnSellCostBuyPrice+232, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+232
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+232, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+232
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+232
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+232
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+232
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+232
                        , 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 240, 232, 232, 232
                    , 232, 232, 232, 0, 0, 232, 232)
                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+240, returnSellCostBuyPrice = returnSellCostBuyPrice+232, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+232
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+232, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+232
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+232
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+232
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+232
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+232;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-10-04 21:42:51' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '2', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '17', '19', '1', '2026-10-04 21:42:51','0','0'); -- id=3653
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.10', '00087', '13', '12', '87', '10', '11.3', '113', '0', '', '1', '0', '87', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','11.3','113','0','','0'); -- id=56
UPDATE returnsellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where returnsellbilldetailid = 56;
 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 (87, '2026-10-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 113, 111, 111, 111
                    , 111, 111, 111, 0, 10, 0, 0, 111, 111)
                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+113, returnSellCostBuyPrice = returnSellCostBuyPrice+111, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+111
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+111, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+111
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+111
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+111
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+111
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+111
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+10;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 113, 111, 111, 111
                    , 111, 111, 111, 0, 0, 111, 111)
                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+113, returnSellCostBuyPrice = returnSellCostBuyPrice+111, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+111
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+111, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+111
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+111
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+111
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+111
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+111;
UPDATE storedetail SET  productquantity = '133', userid = '1', storedetaildate = '2026-10-04 21:42:51' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '10', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '123', '133', '1', '2026-10-04 21:42:51','0','0'); -- id=3654
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 ('5.90', '00086', '13', '12', '86', '1', '6.25', '6.25', '0', '', '1', '0', '86', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','6.25','6.25','0','','0'); -- id=57
UPDATE returnsellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where returnsellbilldetailid = 57;
 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 (86, '2026-10-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 6.25, 5.9, 5.9, 5.9
                    , 5.9, 5.9, 5.9, 0, 1, 0, 0, 5.9, 5.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+6.25, returnSellCostBuyPrice = returnSellCostBuyPrice+5.9, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+5.9
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+5.9, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+5.9
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+5.9
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+5.9
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+5.9
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+5.9
                        , 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 6.25, 5.9, 5.9, 5.9
                    , 5.9, 5.9, 5.9, 0, 0, 5.9, 5.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+6.25, returnSellCostBuyPrice = returnSellCostBuyPrice+5.9, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+5.9
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+5.9, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+5.9
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+5.9
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+5.9
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+5.9
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+5.9;
UPDATE storedetail SET  productquantity = '435', userid = '1', storedetaildate = '2026-10-04 21:42:52' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '1', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '434', '435', '1', '2026-10-04 21:42:52','0','0'); -- id=3655
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 ('18.00', '00081', '13', '14', '81', '2', '19', '38', '0', '', '1', '0', '81', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','19','38','0','','0'); -- id=58
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 58;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 38, 36, 36, 36
                    , 36, 36, 36, 0, 2, 0, 0, 36, 36)
                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+38, returnSellCostBuyPrice = returnSellCostBuyPrice+36, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+36
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+36, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+36
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+36
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+36
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+36
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+36
                        , 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 38, 36, 36, 36
                    , 36, 36, 36, 0, 0, 36, 36)
                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+38, returnSellCostBuyPrice = returnSellCostBuyPrice+36, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+36
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+36, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+36
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+36
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+36
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+36
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+36;
UPDATE storedetail SET  productquantity = '209', userid = '1', storedetaildate = '2026-10-04 21:42:52' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '207', '209', '1', '2026-10-04 21:42:52','0','0'); -- id=3656
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 ('32.00', '00440', '13', '12', '440', '1', '36', '36', '0', '', '1', '0', '440', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','36','36','0','','0'); -- id=59
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 59;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 36, 32, 32, 32
                    , 32, 32, 32, 0, 1, 0, 0, 32, 32)
                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+36, returnSellCostBuyPrice = returnSellCostBuyPrice+32, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+32
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+32, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+32
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+32
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+32
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+32
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+32
                        , 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 36, 32, 32, 32
                    , 32, 32, 32, 0, 0, 32, 32)
                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+36, returnSellCostBuyPrice = returnSellCostBuyPrice+32, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+32
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+32, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+32
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+32
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+32
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+32
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+32;
UPDATE storedetail SET  productquantity = '208', userid = '1', storedetaildate = '2026-10-04 21:42:52' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '1', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '207', '208', '1', '2026-10-04 21:42:52','0','0'); -- id=3657
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 ('3.50', '00446', '13', '12', '446', '1', '5', '5', '0', '', '1', '0', '446', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','5','5','0','','0'); -- id=60
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 60;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 5, 3.5, 3.5, 3.5
                    , 3.5, 3.5, 3.5, 0, 1, 0, 0, 3.5, 3.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+5, returnSellCostBuyPrice = returnSellCostBuyPrice+3.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3.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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 5, 3.5, 3.5, 3.5
                    , 3.5, 3.5, 3.5, 0, 0, 3.5, 3.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+5, returnSellCostBuyPrice = returnSellCostBuyPrice+3.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3.5;
UPDATE storedetail SET  productquantity = '240', userid = '1', storedetaildate = '2026-10-04 21:42:53' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '1', '0', '13', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '239', '240', '1', '2026-10-04 21:42:53','0','0'); -- id=3658
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '438.3', '438.3', '2026-10-04', '1', '0', '0', '2026-10-04 21:42:53','اضافة فاتورة مردود مبيعات رقم 13','1','0',null,'0','13','returnsellbillController.php?do=showDetail&returnsellbillid=13'); -- id=1312
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1312', '143', '438.3', '','0'); -- id=1318
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '997220.33', 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 ('1312', '430', '438.3', '','0'); -- id=1314
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '6793.8', 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 dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '420.4', '420.4', '2026-10-04', '1', '0', '0', '2026-10-04 21:42:53','اضافة فاتورة مردود مبيعات رقم 13 - صرف البضاعة من المخزن','1','0',null,'0','13','returnsellbillController.php?do=showDetail&returnsellbillid=13'); -- id=1313
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1313', '382', '420.4', '','0'); -- id=1319
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2424644.6', 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 ('1313', '402', '420.4', '','0'); -- id=1315
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '904632.99', 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='1312,0,1313' where returnsellbillid=13;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 438.3, 420.4, 420.4, 420.4
                    , 420.4, 420.4, 420.4 ,0, 0, 420.4, 420.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+438.3, returnSellCostBuyPrice = returnSellCostBuyPrice+420.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+420.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+420.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+420.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+420.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+420.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+420.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+420.4;
 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-04', 0, 0, 0
                    , 0, 0, 0, 0
                    , 438.3, 420.4, 420.4, 420.4
                    , 420.4, 420.4, 420.4 ,0, 0, 420.4, 420.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+438.3, returnSellCostBuyPrice = returnSellCostBuyPrice+420.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+420.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+420.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+420.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+420.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+420.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+420.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+420.4;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -438.3, -420.4, -420.4
                    , -420.4, -420.4, -420.4, -420.4, -420.4, -420.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-438.3, netSellCostBuyPrice = netSellCostBuyPrice+-420.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-420.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-420.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-420.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-420.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-420.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-420.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-420.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac2ab86a046b and sellbillId = 13 and returnsellbillId = 13
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:12:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:42:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:42:55', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=3477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:43:08', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3478
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:43:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-10-04 21:43:21', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=13'); -- id=3480
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:43:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3481
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:43:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3482
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:13:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:43:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:43:51', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=221'); -- id=3483
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:14:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:44:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:44:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3484
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:15:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:45:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-04 21:45:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3485
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:15:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:45:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:45:05', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=220'); -- id=3486
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 18:16:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 21:46:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 21:46:49', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 20:19:19";
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-04 20:19:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 23:49:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-04 23:49:24', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=3488
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-04 20:19:25";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-04 23:49:26', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=3489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 20:19:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 23:49:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 23:49:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3490
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 20:25:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 23:55:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 23:55:07', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3491

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac2c9ee7ec44
-- ----------------------------------------------------------------------------------------------------

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-04 23:55:07', '06ac2c9ee7ec44', '1', '0.00', '0', '0', '1', '758.00', '758', '758', '0', '1', '2026-10-04 23:55:07', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '33' ,'0','','','','','-1','0','0','0','0','0','758','0','','0','0','758','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-04','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=222
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','اضافة فاتورة مبيعات','222', '0', '2026-10-04 23:55:08', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '758', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-04 23:55:07','0','0','',''); -- id=369
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+32 where id = 91;
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','00206', '222', '6', '206', '32', '19', '608', '0', '', '1', '2026-10-04 23:55:08', '206', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','91-32,','1','1','0','0','19','608','0','','0','0.00','0','0','0','0'); -- id=1948
UPDATE sellbilldetail SET  lastbuyprice = 14.00 , meanbuyprice = 14.00, lastbuyprice_withDiscount = 14.00, meanbuyprice_withDiscount = 14.00
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where sellbilldetailid = 1948;
 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 (206, '2026-10-04', 608, 448, 448
                    , 448, 448, 448, 448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32, 0, 448, 448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+608, sellCostBuyPrice =sellCostBuyPrice+448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+448
                        , returnSellVal = returnSellVal+0, 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+32
                        , 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-04', 608, 448, 448
                    , 448, 448, 448, 448
                    , 0, 0, 0, 0
                    , 0, 0, 0, 448, 448, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+608, sellCostBuyPrice =sellCostBuyPrice+448
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+448, sellCostMeanBuyPrice = sellCostMeanBuyPrice+448
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+448, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+448
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+448
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+448
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+448
                        , returnSellVal = returnSellVal+0, 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-04 23:55:08' WHERE storedetailid = '206';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('206', '1', '32', '1', '222', 'اضافة فاتورة مبيعات', 'sellbillController.php', '47', '15', '1', '2026-10-04 23:55:08','0','0'); -- id=3659
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 ('115','00284', '222', '7', '284', '1', '150', '150', '0', '', '1', '2026-10-04 23:55:08', '284', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','150','0','','0','0.00','0','0','0','0'); -- id=1949
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 1949;
 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 (284, '2026-10-04', 150, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, 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-04', 150, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, 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-04 23:55:09' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '1', '1', '222', 'اضافة فاتورة مبيعات', 'sellbillController.php', '23', '22', '1', '2026-10-04 23:55:09','0','0'); -- id=3660
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-417908.90625',  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 ('-418666.90625','758', '0', '1', 'اضافة فاتورة مبيعات', '222', '-417908.90625', '2026-10-04 23:55:09', '1',  'sellbillController.php','1','','0'); -- id=219
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '758', '758', '2026-10-04', '1', '0', '0', '2026-10-04 23:55:09','اضافة فاتورة مبيعات رقم 222','1','0',null,'0','222','sellbillController.php?do=showDetail&sellbillid=222'); -- id=1314
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1314', '383', '758', '','0'); -- id=1320
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-162466.88', 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 ('1314', '143', '758', '','0'); -- id=1316
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '997978.33', 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 ( '563', '563', '2026-10-04', '1', '0', '0', '2026-10-04 23:55:09','اضافة فاتورة مبيعات رقم 222 - صرف البضاعة من المخزن','1','0',null,'0','222','sellbillController.php?do=showDetail&sellbillid=222'); -- id=1315
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1315', '402', '563', '','0'); -- id=1321
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '905195.99', 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 ('1315', '382', '563', '','0'); -- id=1317
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2424081.6', 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='1314,0,1315' where sellbillid=222;
 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-04', 758, 563, 563
                    , 563, 563, 563, 563
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,563, 563, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+758, sellCostBuyPrice =sellCostBuyPrice+563
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+563, sellCostMeanBuyPrice = sellCostMeanBuyPrice+563
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+563, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+563
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+563
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+563
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+563
                        , returnSellVal = returnSellVal+0, 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-04', 758, 563, 563
                    , 563, 563, 563, 563
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,563, 563, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+758, sellCostBuyPrice =sellCostBuyPrice+563
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+563, sellCostMeanBuyPrice = sellCostMeanBuyPrice+563
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+563, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+563
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+563
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+563
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+563
                        , returnSellVal = returnSellVal+0, 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, 758, 563, 563
                    , 563, 563, 563, 563, 563, 563)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+758, netSellCostBuyPrice = netSellCostBuyPrice+563
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+563
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+563
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+563
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+563
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+563
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+563
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+563;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac2c9ee7ec44 and sellbillId = 222 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-04 20:25:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-04 23:55:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-04 23:55:10', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3492
