UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 10:41:38";
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-16 10:41:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 14:11:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-16 14:11:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=4352
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-16',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-16 10:42:08";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-16 14:12:08', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=4353
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 10:45:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 14:15:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 14:15:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4354
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 10:55:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 14:25:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 14:25:21', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4355

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad2156c7ef45
-- ----------------------------------------------------------------------------------------------------

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-16 14:25:22', '06ad2156c7ef45', '1', '0.00', '0', '22', '2', '15694.37', '12241.61', '12241.61', '0', '1', '2026-10-16 14:25:22', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '323' ,'0','','','','','-1','0','0','0','0','0','12241','0','','0','0','12241.61','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-16','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=309
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','اضافة فاتورة مبيعات','309', '0', '2026-10-16 14:25:22', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '12241.61', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-16 14:25:22','0','0','',''); -- id=524
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+70 where id = 120;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '309', '1', '41', '70', '56.78', '3974.6', '0', '', '1', '2026-10-16 14:25:22', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','120-70,','1','1','0','0','56.78','3974.6','0','','0','0.00','0','0','0','0'); -- id=2483
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 2483;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-16', 3100.1883545501, 3103.1, 3103.1
                    , 3103.1, 3103.1, 3103.1, 3103.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 0, 3103.1, 3103.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100.1883545501, sellCostBuyPrice =sellCostBuyPrice+3103.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3103.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3103.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3103.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3103.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3103.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3103.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3103.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+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-16', 3100.1883545501, 3103.1, 3103.1
                    , 3103.1, 3103.1, 3103.1, 3103.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3103.1, 3103.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100.1883545501, sellCostBuyPrice =sellCostBuyPrice+3103.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3103.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3103.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3103.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3103.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3103.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3103.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3103.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 = '484', userid = '1', storedetaildate = '2026-10-16 14:25:23' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '70', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '554', '484', '1', '2026-10-16 14:25:23','0','0'); -- id=4492
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+120 where id = 128;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.44','00044', '309', '1', '44', '120', '10.82', '1298.4', '0', '', '1', '2026-10-16 14:25:23', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','128-120,','1','1','0','0','10.82','1298.4','0','','0','0.00','0','0','0','0'); -- id=2484
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 2484;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-10-16', 1012.7521158224, 1012.8, 1012.8
                    , 1012.8, 1012.8, 1012.8, 1012.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 0, 1012.8, 1012.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1012.7521158224, sellCostBuyPrice =sellCostBuyPrice+1012.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1012.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1012.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1012.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1012.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1012.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1012.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1012.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+120
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 1012.7521158224, 1012.8, 1012.8
                    , 1012.8, 1012.8, 1012.8, 1012.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1012.8, 1012.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1012.7521158224, sellCostBuyPrice =sellCostBuyPrice+1012.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1012.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1012.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1012.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1012.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1012.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1012.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1012.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 = '1531', userid = '1', storedetaildate = '2026-10-16 14:25:23' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '120', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1651', '1531', '1', '2026-10-16 14:25:23','0','0'); -- id=4493
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+35 where id = 121;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '309', '1', '42', '35', '37.87', '1325.4499999999998', '0', '', '1', '2026-10-16 14:25:23', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','121-35,','1','1','0','0','37.87','1325.45','0','','0','0.00','0','0','0','0'); -- id=2485
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2485;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-16', 1033.8511182354, 1032.5, 1032.5
                    , 1032.5, 1032.5, 1032.5, 1032.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 0, 1032.5, 1032.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1033.8511182354, sellCostBuyPrice =sellCostBuyPrice+1032.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1032.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1032.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1032.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1032.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1032.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1032.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1032.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+35
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 1033.8511182354, 1032.5, 1032.5
                    , 1032.5, 1032.5, 1032.5, 1032.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1032.5, 1032.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1033.8511182354, sellCostBuyPrice =sellCostBuyPrice+1032.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1032.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1032.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1032.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1032.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1032.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1032.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1032.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 = '765', userid = '1', storedetaildate = '2026-10-16 14:25:23' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '35', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '800', '765', '1', '2026-10-16 14:25:23','0','0'); -- id=4494
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+45 where id = 127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '309', '1', '43', '45', '37.87', '1704.1499999999999', '0', '', '1', '2026-10-16 14:25:23', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','127-45,','1','1','0','0','37.87','1704.15','0','','0','0.00','0','0','0','0'); -- id=2486
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2486;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-10-16', 1329.2371520169, 1327.5, 1327.5
                    , 1327.5, 1327.5, 1327.5, 1327.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 0, 1327.5, 1327.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1329.2371520169, sellCostBuyPrice =sellCostBuyPrice+1327.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1327.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1327.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1327.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1327.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1327.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+45
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 1329.2371520169, 1327.5, 1327.5
                    , 1327.5, 1327.5, 1327.5, 1327.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1327.5, 1327.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1329.2371520169, sellCostBuyPrice =sellCostBuyPrice+1327.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1327.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1327.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1327.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1327.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1327.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 = '717', userid = '1', storedetaildate = '2026-10-16 14:25:24' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '45', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '762', '717', '1', '2026-10-16 14:25:24','0','0'); -- id=4495
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 125;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '309', '1', '47', '10', '114.97', '1149.7', '0', '', '1', '2026-10-16 14:25:24', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','125-10,','1','1','0','0','114.97','1149.7','0','','0','0.00','0','0','0','0'); -- id=2487
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2487;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-16', 896.7661025578, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+896.7661025578, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 896.7661025578, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+896.7661025578, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 14:25:24' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '10', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '141', '131', '1', '2026-10-16 14:25:24','0','0'); -- id=4496
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 124;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00046', '309', '1', '46', '10', '114.97', '1149.7', '0', '', '1', '2026-10-16 14:25:24', '46', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','124-10,','1','1','0','0','114.97','1149.7','0','','0','0.00','0','0','0','0'); -- id=2488
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2488;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-16', 896.7661025578, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+896.7661025578, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 896.7661025578, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+896.7661025578, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '1', storedetaildate = '2026-10-16 14:25:24' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '10', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '115', '105', '1', '2026-10-16 14:25:24','0','0'); -- id=4497
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('417','00058', '309', '1', '58', '3', '534.26', '1602.78', '0', '', '1', '2026-10-16 14:25:24', '58', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','534.26','1602.78','0','','0','0.00','0','0','0','0'); -- id=2489
UPDATE sellbilldetail SET  lastbuyprice = 417.00 , meanbuyprice = 417.00, lastbuyprice_withDiscount = 417.00, meanbuyprice_withDiscount = 417.00
        , lastbuyprice_withTax = 417, meanbuyprice_withTax = 417, lastbuyprice_withDiscountAndTax = 417
                where sellbilldetailid = 2489;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (58, '2026-10-16', 1250.1685429743, 1251, 1251
                    , 1251, 1251, 1251, 1251
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1251, 1251, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1250.1685429743, sellCostBuyPrice =sellCostBuyPrice+1251
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1251, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1251
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1251, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1251
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1251
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1251
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1251
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 1250.1685429743, 1251, 1251
                    , 1251, 1251, 1251, 1251
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1251, 1251, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1250.1685429743, sellCostBuyPrice =sellCostBuyPrice+1251
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1251, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1251
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1251, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1251
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1251
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1251
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1251
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 14:25:24' WHERE storedetailid = '58';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('58', '1', '3', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '1', '2026-10-16 14:25:24','0','0'); -- id=4498
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 126;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('36.95','00051', '309', '1', '51', '3', '47.34', '142.02', '0', '', '1', '2026-10-16 14:25:25', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','126-3,','1','1','0','0','47.34','142.02','0','','0','0.00','0','0','0','0'); -- id=2490
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 2490;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-10-16', 110.77561266875, 110.85, 110.85
                    , 110.85, 110.85, 110.85, 110.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 110.85, 110.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+110.77561266875, sellCostBuyPrice =sellCostBuyPrice+110.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 110.77561266875, 110.85, 110.85
                    , 110.85, 110.85, 110.85, 110.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110.85, 110.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+110.77561266875, sellCostBuyPrice =sellCostBuyPrice+110.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2026-10-16 14:25:25' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '3', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '152', '149', '1', '2026-10-16 14:25:25','0','0'); -- id=4499
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('68.63','00052', '309', '1', '52', '3', '87.92', '263.76', '0', '', '1', '2026-10-16 14:25:25', '52', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','87.92','263.76','0','','0','0.00','0','0','0','0'); -- id=2491
UPDATE sellbilldetail SET  lastbuyprice = 68.63 , meanbuyprice = 68.63, lastbuyprice_withDiscount = 68.63, meanbuyprice_withDiscount = 68.63
        , lastbuyprice_withTax = 68.63, meanbuyprice_withTax = 68.63, lastbuyprice_withDiscountAndTax = 68.63
                where sellbilldetailid = 2491;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (52, '2026-10-16', 205.73282352844, 205.89, 205.89
                    , 205.89, 205.89, 205.89, 205.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 205.89, 205.89, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+205.73282352844, sellCostBuyPrice =sellCostBuyPrice+205.89
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205.89, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205.89
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205.89, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205.89
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+205.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+205.89
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+205.89
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 205.73282352844, 205.89, 205.89
                    , 205.89, 205.89, 205.89, 205.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 205.89, 205.89, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+205.73282352844, sellCostBuyPrice =sellCostBuyPrice+205.89
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205.89, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205.89
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205.89, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205.89
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+205.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+205.89
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+205.89
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 14:25:25' WHERE storedetailid = '52';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '1', '3', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '123', '1', '2026-10-16 14:25:25','0','0'); -- id=4500
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 131;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 146;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.5','00045', '309', '1', '45', '4', '304.33', '1217.32', '0', '', '1', '2026-10-16 14:25:25', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','131-2,146-2,','1','1','0','0','304.33','1217.32','0','','0','0.00','0','0','0','0'); -- id=2492
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 2492;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-10-16', 949.50970858977, 950, 950
                    , 950, 950, 950, 950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 950, 950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+949.50970858977, sellCostBuyPrice =sellCostBuyPrice+950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 949.50970858977, 950, 950
                    , 950, 950, 950, 950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 950, 950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+949.50970858977, sellCostBuyPrice =sellCostBuyPrice+950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '112', userid = '1', storedetaildate = '2026-10-16 14:25:25' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '4', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '116', '112', '1', '2026-10-16 14:25:25','0','0'); -- id=4501
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 123;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('137.25','00050', '309', '1', '50', '1', '175.83', '175.83', '0', '', '1', '2026-10-16 14:25:25', '50', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','123-1,','1','1','0','0','175.83','175.83','0','','0','0.00','0','0','0','0'); -- id=2493
UPDATE sellbilldetail SET  lastbuyprice = 137.25 , meanbuyprice = 137.25, lastbuyprice_withDiscount = 137.25, meanbuyprice_withDiscount = 137.25
        , lastbuyprice_withTax = 137.25, meanbuyprice_withTax = 137.25, lastbuyprice_withDiscountAndTax = 137.25
                where sellbilldetailid = 2493;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (50, '2026-10-16', 137.14741568473, 137.25, 137.25
                    , 137.25, 137.25, 137.25, 137.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 137.25, 137.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+137.14741568473, sellCostBuyPrice =sellCostBuyPrice+137.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+137.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+137.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+137.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+137.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+137.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+137.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+137.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+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-16', 137.14741568473, 137.25, 137.25
                    , 137.25, 137.25, 137.25, 137.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 137.25, 137.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+137.14741568473, sellCostBuyPrice =sellCostBuyPrice+137.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+137.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+137.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+137.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+137.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+137.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+137.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+137.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 = '120', userid = '1', storedetaildate = '2026-10-16 14:25:26' WHERE storedetailid = '50';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '1', '1', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '121', '120', '1', '2026-10-16 14:25:26','0','0'); -- id=4502
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 122;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50.67','00053', '309', '1', '53', '10', '64.92', '649.2', '0', '', '1', '2026-10-16 14:25:26', '53', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','122-10,','1','1','0','0','64.92','649.2','0','','0','0.00','0','0','0','0'); -- id=2494
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 2494;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-10-16', 506.37605791121, 506.7, 506.7
                    , 506.7, 506.7, 506.7, 506.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 506.7, 506.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+506.37605791121, sellCostBuyPrice =sellCostBuyPrice+506.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+506.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+506.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+506.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+506.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+506.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+506.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+506.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 506.37605791121, 506.7, 506.7
                    , 506.7, 506.7, 506.7, 506.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 506.7, 506.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+506.37605791121, sellCostBuyPrice =sellCostBuyPrice+506.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+506.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+506.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+506.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+506.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+506.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+506.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+506.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '109', userid = '1', storedetaildate = '2026-10-16 14:25:26' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '10', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '119', '109', '1', '2026-10-16 14:25:26','0','0'); -- id=4503
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('79.18','00054', '309', '1', '54', '4', '101.44', '405.76', '0', '', '1', '2026-10-16 14:25:26', '54', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','101.44','405.76','0','','0','0.00','0','0','0','0'); -- id=2495
UPDATE sellbilldetail SET  lastbuyprice = 79.18 , meanbuyprice = 79.18, lastbuyprice_withDiscount = 79.18, meanbuyprice_withDiscount = 79.18
        , lastbuyprice_withTax = 79.18, meanbuyprice_withTax = 79.18, lastbuyprice_withDiscountAndTax = 79.18
                where sellbilldetailid = 2495;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (54, '2026-10-16', 316.4928361954, 316.72, 316.72
                    , 316.72, 316.72, 316.72, 316.72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 316.72, 316.72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+316.4928361954, sellCostBuyPrice =sellCostBuyPrice+316.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 316.4928361954, 316.72, 316.72
                    , 316.72, 316.72, 316.72, 316.72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 316.72, 316.72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+316.4928361954, sellCostBuyPrice =sellCostBuyPrice+316.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+316.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+316.72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+316.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+316.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+316.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+316.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+316.72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 14:25:26' WHERE storedetailid = '54';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('54', '1', '4', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '83', '1', '2026-10-16 14:25:26','0','0'); -- id=4504
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 129;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.79','00048', '309', '1', '48', '3', '67.63', '202.89', '0', '', '1', '2026-10-16 14:25:26', '48', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','129-3,','1','1','0','0','67.63','202.89','0','','0','0.00','0','0','0','0'); -- id=2496
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 2496;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-16', 158.25421809859, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+158.25421809859, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 158.25421809859, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+158.25421809859, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '176', userid = '1', storedetaildate = '2026-10-16 14:25:26' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '3', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '179', '176', '1', '2026-10-16 14:25:26','0','0'); -- id=4505
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('84.4','00056', '309', '1', '56', '1', '108.2', '108.2', '0', '', '1', '2026-10-16 14:25:27', '56', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','108.2','108.2','0','','0','0.00','0','0','0','0'); -- id=2497
UPDATE sellbilldetail SET  lastbuyprice = 84.40 , meanbuyprice = 84.40, lastbuyprice_withDiscount = 84.40, meanbuyprice_withDiscount = 84.40
        , lastbuyprice_withTax = 84.4, meanbuyprice_withTax = 84.4, lastbuyprice_withDiscountAndTax = 84.4
                where sellbilldetailid = 2497;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (56, '2026-10-16', 84.396009651869, 84.4, 84.4
                    , 84.4, 84.4, 84.4, 84.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 84.4, 84.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+84.396009651869, sellCostBuyPrice =sellCostBuyPrice+84.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.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+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-16', 84.396009651869, 84.4, 84.4
                    , 84.4, 84.4, 84.4, 84.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 84.4, 84.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+84.396009651869, sellCostBuyPrice =sellCostBuyPrice+84.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.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 = '18', userid = '1', storedetaildate = '2026-10-16 14:25:27' WHERE storedetailid = '56';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('56', '1', '1', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '18', '1', '2026-10-16 14:25:27','0','0'); -- id=4506
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 130;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('254','00314', '309', '1', '314', '1', '324.61', '324.61', '0', '', '1', '2026-10-16 14:25:27', '314', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','130-1,','1','1','0','0','324.61','324.61','0','','0','0.00','0','0','0','0'); -- id=2498
UPDATE sellbilldetail SET  lastbuyprice = 254.00 , meanbuyprice = 254.00, lastbuyprice_withDiscount = 254.00, meanbuyprice_withDiscount = 254.00
        , lastbuyprice_withTax = 254, meanbuyprice_withTax = 254, lastbuyprice_withDiscountAndTax = 254
                where sellbilldetailid = 2498;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (314, '2026-10-16', 253.1958289565, 254, 254
                    , 254, 254, 254, 254
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 254, 254, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+253.1958289565, sellCostBuyPrice =sellCostBuyPrice+254
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+254, sellCostMeanBuyPrice = sellCostMeanBuyPrice+254
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+254, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+254
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+254
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+254
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+254
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 253.1958289565, 254, 254
                    , 254, 254, 254, 254
                    , 0, 0, 0, 0
                    , 0, 0, 0, 254, 254, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+253.1958289565, sellCostBuyPrice =sellCostBuyPrice+254
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+254, sellCostMeanBuyPrice = sellCostMeanBuyPrice+254
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+254, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+254
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+254
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+254
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+254
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 14:25:27' WHERE storedetailid = '314';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('314', '1', '1', '1', '309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '16', '1', '2026-10-16 14:25:27','0','0'); -- id=4507
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-811218.14',  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 ('-823459.75','12241.61', '0', '1', 'اضافة فاتورة مبيعات', '309', '-811218.14', '2026-10-16 14:25:27', '1',  'sellbillController.php','1','','0'); -- id=326
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15694.37', '15694.37', '2026-10-16', '1', '0', '0', '2026-10-16 14:25:27','اضافة فاتورة مبيعات رقم 309','1','0',null,'0','309','sellbillController.php?do=showDetail&sellbillid=309'); -- id=1657
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1657', '383', '12241.61', '','0'); -- id=1671
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '32115.1', 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 ('1657', '398', '3452.76', '','0'); -- id=1672
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '51327.19', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1657', '143', '15694.37', '','0'); -- id=1661
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1328567.7', 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 ( '12245.08', '12245.08', '2026-10-16', '1', '0', '0', '2026-10-16 14:25:27','اضافة فاتورة مبيعات رقم 309 - صرف البضاعة من المخزن','1','0',null,'0','309','sellbillController.php?do=showDetail&sellbillid=309'); -- id=1658
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1658', '402', '12245.08', '','0'); -- id=1673
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1188842.13', 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 ('1658', '382', '12245.08', '','0'); -- id=1662
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2319631.96', 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='1657,0,1658' where sellbillid=309;
 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-16', 12241.61, 12245.08, 12245.08
                    , 12245.08, 12245.08, 12245.08, 12245.08
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12245.08, 12245.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12241.61, sellCostBuyPrice =sellCostBuyPrice+12245.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12245.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12245.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12245.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12245.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12245.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12245.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12245.08
                        , returnSellVal = returnSellVal+0, 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-16', 12241.61, 12245.08, 12245.08
                    , 12245.08, 12245.08, 12245.08, 12245.08
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12245.08, 12245.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12241.61, sellCostBuyPrice =sellCostBuyPrice+12245.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12245.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12245.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12245.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12245.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12245.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12245.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12245.08
                        , returnSellVal = returnSellVal+0, 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, 12241.61, 12245.08, 12245.08
                    , 12245.08, 12245.08, 12245.08, 12245.08, 12245.08, 12245.08)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+12241.61, netSellCostBuyPrice = netSellCostBuyPrice+12245.08
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12245.08
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12245.08
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12245.08
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12245.08
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12245.08
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12245.08
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12245.08;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad2156c7ef45 and sellbillId = 309 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad217b9c2774
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(3,@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-16 15:38:56', '06ad217b9c2774', '3', '3517.80', '10131.8', '0', '1', '6614.00', '6614', '0', '6614', '1', '2026-10-16 15:38:56', '', '1', '0', 'عبدالحي الشاذلي ', '1', '1', '3', '0', '3 - عبدالحي الشاذلي ', '194' ,'0','','','','','-1','0','0','0','0','0','6614','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-16','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=310
UPDATE client SET  clientdebt = '10131.8', userid = '1' WHERE clientid = '3';
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 ('3','3517.80','6614','0','اضافة فاتورة مبيعات','310', '10131.8', '2026-10-16 15:38:56', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6614', '0', null, '0', null, null,'', '0','1','1','6614','1','2026-10-16 15:38:56','0','0','',''); -- id=525
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00385', '310', '12', '385', '60', '10.2', '612', '0', '', '0', '2026-10-16 15:38:56', '385', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','10.2','612','0','','0','','0','0','0','0'); -- id=2499
UPDATE sellbilldetail SET  lastbuyprice = 8.50 , meanbuyprice = 8.50, lastbuyprice_withDiscount = 8.50, meanbuyprice_withDiscount = 8.50
        , lastbuyprice_withTax = 8.5, meanbuyprice_withTax = 8.5, lastbuyprice_withDiscountAndTax = 8.5
                where sellbilldetailid = 2499;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (385, '2026-10-16', 612, 510, 510
                    , 510, 510, 510, 510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 510, 510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+612, sellCostBuyPrice =sellCostBuyPrice+510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 612, 510, 510
                    , 510, 510, 510, 510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 510, 510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+612, sellCostBuyPrice =sellCostBuyPrice+510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '330', userid = '1', storedetaildate = '2026-10-16 15:38:57' WHERE storedetailid = '385';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '1', '60', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '390', '330', '1', '2026-10-16 15:38:57','0','0'); -- id=4508
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '310', '12', '83', '10', '46', '460', '0', '', '0', '2026-10-16 15:38:57', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-10,','1','1','0','0','46','460','0','','0','0.00','0','0','0','0'); -- id=2500
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 = 2500;
 INSERT INTO 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-16', 460, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 460, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '243', userid = '1', storedetaildate = '2026-10-16 15:38:57' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '10', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '253', '243', '1', '2026-10-16 15:38:57','0','0'); -- id=4509
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 106;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('966','00523', '310', '6', '523', '1', '965', '965', '0', '', '0', '2026-10-16 15:38:57', '523', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','106-1,','1','1','0','0','965','965','0','','0','0.00','0','0','0','0'); -- id=2501
UPDATE sellbilldetail SET  lastbuyprice = 941.00 , meanbuyprice = 952.84, lastbuyprice_withDiscount = 941.00, meanbuyprice_withDiscount = 952.84
        , lastbuyprice_withTax = 941, meanbuyprice_withTax = 952.84, lastbuyprice_withDiscountAndTax = 941
                where sellbilldetailid = 2501;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (523, '2026-10-16', 965, 941, 941
                    , 952.84, 941, 952.84, 953.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 941, 952.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+965, sellCostBuyPrice =sellCostBuyPrice+941
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+941, sellCostMeanBuyPrice = sellCostMeanBuyPrice+952.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+941, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+952.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+953.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+941
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+952.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-16', 965, 941, 941
                    , 952.84, 941, 952.84, 953.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 941, 952.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+965, sellCostBuyPrice =sellCostBuyPrice+941
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+941, sellCostMeanBuyPrice = sellCostMeanBuyPrice+952.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+941, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+952.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+953.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+941
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+952.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 = '17', userid = '1', storedetaildate = '2026-10-16 15:38:57' WHERE storedetailid = '523';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('523', '1', '1', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '17', '1', '2026-10-16 15:38:57','0','0'); -- id=4510
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 105;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('960','00522', '310', '6', '522', '1', '960', '960', '0', '', '0', '2026-10-16 15:38:57', '522', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','105-1,','1','1','0','0','960','960','0','','0','0.00','0','0','0','0'); -- id=2502
UPDATE sellbilldetail SET  lastbuyprice = 934.40 , meanbuyprice = 945.23, lastbuyprice_withDiscount = 934.40, meanbuyprice_withDiscount = 945.23
        , lastbuyprice_withTax = 934.4, meanbuyprice_withTax = 945.23, lastbuyprice_withDiscountAndTax = 934.4
                where sellbilldetailid = 2502;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (522, '2026-10-16', 960, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 960, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 15:38:57' WHERE storedetailid = '522';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('522', '1', '1', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '24', '1', '2026-10-16 15:38:57','0','0'); -- id=4511
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 113;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1000','00229', '310', '10', '229', '2', '1150', '2300', '0', '', '0', '2026-10-16 15:38:57', '229', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','113-2,','1','1','0','0','1150','2300','0','','0','0.00','0','0','0','0'); -- id=2503
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 = 2503;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (229, '2026-10-16', 2300, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, 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+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-16', 2300, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, 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-16 15:38:58' WHERE storedetailid = '229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '1', '2', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '38', '1', '2026-10-16 15:38:58','0','0'); -- id=4512
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('7','00368', '310', '4', '368', '60', '7.5', '450', '0', '', '0', '2026-10-16 15:38:58', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','7.5','450','0','','0','0.00','0','0','0','0'); -- id=2504
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2504;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-16', 450, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 450, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '169', userid = '1', storedetaildate = '2026-10-16 15:38:58' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '60', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '229', '169', '1', '2026-10-16 15:38:58','0','0'); -- id=4513
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 where id = 92;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13.8','00280', '310', '4', '280', '30', '14.3', '429', '0', '', '0', '2026-10-16 15:38:58', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','92-30,','1','1','0','0','14.3','429','0','','0','0.00','0','0','0','0'); -- id=2505
UPDATE sellbilldetail SET  lastbuyprice = 13.80 , meanbuyprice = 13.80, lastbuyprice_withDiscount = 13.80, meanbuyprice_withDiscount = 13.80
        , lastbuyprice_withTax = 13.8, meanbuyprice_withTax = 13.8, lastbuyprice_withDiscountAndTax = 13.8
                where sellbilldetailid = 2505;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (280, '2026-10-16', 429, 414, 414
                    , 414, 414, 414, 414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 414, 414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+429, sellCostBuyPrice =sellCostBuyPrice+414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+414
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 429, 414, 414
                    , 414, 414, 414, 414
                    , 0, 0, 0, 0
                    , 0, 0, 0, 414, 414, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+429, sellCostBuyPrice =sellCostBuyPrice+414
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+414, sellCostMeanBuyPrice = sellCostMeanBuyPrice+414
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+414, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+414
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+414
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+414
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+414
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '205', userid = '1', storedetaildate = '2026-10-16 15:38:58' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '30', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '235', '205', '1', '2026-10-16 15:38:58','0','0'); -- id=4514
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 where id = 93;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00279', '310', '4', '279', '30', '14.6', '438', '0', '', '0', '2026-10-16 15:38:58', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','93-30,','1','1','0','0','14.6','438','0','','0','0.00','0','0','0','0'); -- id=2506
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 = 2506;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (279, '2026-10-16', 438, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+438, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 438, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+438, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '111', userid = '1', storedetaildate = '2026-10-16 15:38:58' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '30', '1', '310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '141', '111', '1', '2026-10-16 15:38:58','0','0'); -- id=4515
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6614', '6614', '2026-10-16', '1', '0', '0', '2026-10-16 15:38:59','اضافة فاتورة مبيعات رقم 310','1','0',null,'0','310','sellbillController.php?do=showDetail&sellbillid=310'); -- id=1659
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1659', '427', '6614', '','0'); -- id=1674
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '10131.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1659', '143', '6614', '','0'); -- id=1663
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1335181.7', 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 ( '6035.4', '6035.4', '2026-10-16', '1', '0', '0', '2026-10-16 15:38:59','اضافة فاتورة مبيعات رقم 310 - صرف البضاعة من المخزن','1','0',null,'0','310','sellbillController.php?do=showDetail&sellbillid=310'); -- id=1660
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1660', '402', '6035.4', '','0'); -- id=1675
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1194877.53', 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 ('1660', '382', '6035.4', '','0'); -- id=1664
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2313596.56', 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='1659,0,1660' where sellbillid=310;
 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-16', 6614, 6035.4, 6035.4
                    , 6071.07, 6035.4, 6071.07, 6060.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6035.4, 6071.07, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6614, sellCostBuyPrice =sellCostBuyPrice+6035.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6035.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6071.07
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6035.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6071.07
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6060.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6035.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6071.07
                        , returnSellVal = returnSellVal+0, 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 (3, '2026-10-16', 6614, 6035.4, 6035.4
                    , 6071.07, 6035.4, 6071.07, 6060.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6035.4, 6071.07, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6614, sellCostBuyPrice =sellCostBuyPrice+6035.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6035.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6071.07
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6035.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6071.07
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6060.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6035.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6071.07
                        , returnSellVal = returnSellVal+0, 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, 6614, 6035.4, 6035.4
                    , 6071.07, 6035.4, 6071.07, 6060.7, 6035.4, 6071.07)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6614, netSellCostBuyPrice = netSellCostBuyPrice+6035.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6035.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6071.07
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6035.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6071.07
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6060.7
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6035.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6071.07;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad217b9c2774 and sellbillId = 310 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 12:09:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 15:39:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 15:39:00', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4358
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-16 16:48:53', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-16','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=67
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('67', '0', '0', '', ''); -- id=67
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 ('67','0','0','0','إضافة عميل جديد','67', '0', '2026-10-16 16:48:53', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=526
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-16 16:48:53'); -- id=500
UPDATE client SET clientname = 'ايمن الشرقاوي', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-16', 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='500',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 = '67';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 13:57:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 17:27:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 17:27:18', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4359
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 13:57:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 17:27:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 17:27:58', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4360

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad2426547978
-- ----------------------------------------------------------------------------------------------------

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-16 17:27:59', '06ad2426547978', '1', '0.00', '0', '0', '1', '3510.00', '3510', '3510', '0', '1', '2026-10-16 17:27:59', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','3510','0','','0','0','3510','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-16','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=311
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','اضافة فاتورة مبيعات','311', '0', '2026-10-16 17:27:59', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3510', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-16 17:27:59','0','0','',''); -- id=527
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '311', '8', '28', '6', '585', '3510', '0', '', '1', '2026-10-16 17:27:59', '28', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','585','3510','0','','0','0.00','0','0','0','0'); -- id=2507
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 = 2507;
 INSERT INTO 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-16', 3510, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 3510, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 17:27:59' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '6', '1', '311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '5', '1', '2026-10-16 17:27:59','0','0'); -- id=4516
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-807708.125',  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 ('-811218.125','3510', '0', '1', 'اضافة فاتورة مبيعات', '311', '-807708.125', '2026-10-16 17:27:59', '1',  'sellbillController.php','1','','0'); -- id=327
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3510', '3510', '2026-10-16', '1', '0', '0', '2026-10-16 17:28:00','اضافة فاتورة مبيعات رقم 311','1','0',null,'0','311','sellbillController.php?do=showDetail&sellbillid=311'); -- id=1661
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1661', '383', '3510', '','0'); -- id=1676
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '35625.1', 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 ('1661', '143', '3510', '','0'); -- id=1665
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1338691.7', 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 ( '2850', '2850', '2026-10-16', '1', '0', '0', '2026-10-16 17:28:00','اضافة فاتورة مبيعات رقم 311 - صرف البضاعة من المخزن','1','0',null,'0','311','sellbillController.php?do=showDetail&sellbillid=311'); -- id=1662
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1662', '402', '2850', '','0'); -- id=1677
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1197727.53', 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 ('1662', '382', '2850', '','0'); -- id=1666
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2310746.56', 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='1661,0,1662' where sellbillid=311;
 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-16', 3510, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, 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-16', 3510, 2850, 2850
                    , 2850, 2850, 2850, 2850
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, 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, 3510, 2850, 2850
                    , 2850, 2850, 2850, 2850, 2850, 2850)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3510, netSellCostBuyPrice = netSellCostBuyPrice+2850
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2850
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2850
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2850
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2850
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2850
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2850
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2850;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad2426547978 and sellbillId = 311 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 13:58:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 17:28:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 17:28:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4361
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 14:52:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 18:22:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 18:22:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4362
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 14:52:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 18:22:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 18:22:58', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4363
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-16 20:13:18', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=4364
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-16 20:13:19', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4365
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-16 20:13:23', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4366
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-16 20:13:32', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4367
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-16 20:13:45', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4368

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =528
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(65,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-16 20:13:45', userid = '1' WHERE clientid = '65';
UPDATE client SET  inUse = 0 where clientid = 65;
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 ('65','4321.00','4321','1','ايصال تحصيل (( قبض من عميل ))','528', '0', '2026-10-16 20:13:32', '1', 'clientPayedDeptController.php', '   ', '4321', '0', null, '0', null, null,'', '-1','1','1','4321','1','','52','0','','.'); -- id=528
UPDATE save SET  savecurrentvalue = '-803387.13',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-807708.13','4321', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '528', '-803387.13', '2026-10-16 20:13:45', '1',  'clientPayedDeptController.php','65','','0'); -- id=328
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4321', '4321', '2026-10-16', '1', '0', '0', '2026-10-16 20:13:46','اضافة ايصال سداد للعميل احمد عماد','1','0','0','0','528','clientPayedDeptController.php?do=show&id=528'); -- id=1663
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1663', '383', '4321', '','0'); -- id=1678
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '39946.1', 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 ('1663', '498', '4321', '','0'); -- id=1667
UPDATE accountstree SET name = 'احمد عماد', customName = 'احمد عماد', customNameEn = 'احمد عماد', nameEn = 'احمد عماد', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 18:27:53' WHERE id = '498';
UPDATE clientdebtchange SET clientid = '65', clientdebtchangebefore = '4321.000', clientdebtchangeamount = '4321.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '528', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-16 20:13:32', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '4321.000',discount='', reciptid='0', dailyentryid = '1663',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='4321',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '528';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-16 20:13:47', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4369
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-16 20:13:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4370
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:43:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:13:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-16 20:13:50', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4371
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 16:44:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:14:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:14:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4372
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:00:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:30:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:30:21', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4373

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad2696fb4529
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-16 20:30:22', '06ad2696fb4529', '1', '0.00', '0', '0', '1', '7464.7', '7464.7', '-7464.7', '0', '1', '2026-10-16 20:30:22', '', '1', '0', 'نقدي','1', '0', '5', '0', 'نقدي', '333', '0', '', '','','','-1','0','0','0','','0','-7464.7','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=21
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','1','اضافة فاتورة مردوات مبيعات','21', '0', '2026-10-16 20:30:22', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '7464.7', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-16 20:30:22','0','0','',''); -- id=529
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('52.75', '00001', '21', '1', '1', '10', '54.78', '547.8', '0', '', '1', '0', '1', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','54.78','547.8','0','','0'); -- id=89
UPDATE returnsellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where returnsellbilldetailid = 89;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 547.8, 527.5, 527.5, 527.5
                    , 527.5, 527.5, 527.5, 0, 10, 0, 0, 527.5, 527.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+547.8, returnSellCostBuyPrice = returnSellCostBuyPrice+527.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+527.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+527.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+527.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+527.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+527.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+527.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+527.5
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 547.8, 527.5, 527.5, 527.5
                    , 527.5, 527.5, 527.5, 0, 0, 527.5, 527.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+547.8, returnSellCostBuyPrice = returnSellCostBuyPrice+527.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+527.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+527.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+527.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+527.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+527.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+527.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+527.5;
UPDATE storedetail SET  productquantity = '1990', userid = '1', storedetaildate = '2026-10-16 20:30:23' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '10', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1980', '1990', '1', '2026-10-16 20:30:23','0','0'); -- id=4517
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('105.00', '00006', '21', '1', '6', '1', '109', '109', '0', '', '1', '0', '6', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','109','109','0','','0'); -- id=90
UPDATE returnsellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where returnsellbilldetailid = 90;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 109, 105, 105, 105
                    , 105, 105, 105, 0, 1, 0, 0, 105, 105)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+109, returnSellCostBuyPrice = returnSellCostBuyPrice+105, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 109, 105, 105, 105
                    , 105, 105, 105, 0, 0, 105, 105)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+109, returnSellCostBuyPrice = returnSellCostBuyPrice+105, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+105
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+105, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+105
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+105
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+105
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+105
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+105;
UPDATE storedetail SET  productquantity = '440', userid = '1', storedetaildate = '2026-10-16 20:30:23' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '1', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '439', '440', '1', '2026-10-16 20:30:23','0','0'); -- id=4518
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('34.80', '00004', '21', '1', '4', '3', '36', '108', '0', '', '1', '0', '4', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','36','108','0','','0'); -- id=91
UPDATE returnsellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where returnsellbilldetailid = 91;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 108, 104.4, 104.4, 104.4
                    , 104.4, 104.4, 104.4, 0, 3, 0, 0, 104.4, 104.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+108, returnSellCostBuyPrice = returnSellCostBuyPrice+104.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+104.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+104.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+104.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+104.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+104.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+104.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+104.4
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 108, 104.4, 104.4, 104.4
                    , 104.4, 104.4, 104.4, 0, 0, 104.4, 104.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+108, returnSellCostBuyPrice = returnSellCostBuyPrice+104.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+104.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+104.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+104.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+104.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+104.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+104.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+104.4;
UPDATE storedetail SET  productquantity = '2936', userid = '1', storedetaildate = '2026-10-16 20:30:23' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '3', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '2933', '2936', '1', '2026-10-16 20:30:23','0','0'); -- id=4519
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('163.00', '00015', '21', '1', '15', '1', '170', '170', '0', '', '1', '0', '15', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','170','170','0','','0'); -- id=92
UPDATE returnsellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where returnsellbilldetailid = 92;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 163, 163, 163
                    , 163, 163, 163, 0, 1, 0, 0, 163, 163)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+163, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+163
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+163, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+163
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+163
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+163
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+163
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+163
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 170, 163, 163, 163
                    , 163, 163, 163, 0, 0, 163, 163)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+170, returnSellCostBuyPrice = returnSellCostBuyPrice+163, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+163
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+163, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+163
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+163
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+163
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+163
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+163;
UPDATE storedetail SET  productquantity = '281', userid = '1', storedetaildate = '2026-10-16 20:30:24' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '1', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '280', '281', '1', '2026-10-16 20:30:24','0','0'); -- id=4520
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('63.00', '00012', '21', '1', '12', '2', '66', '132', '0', '', '1', '0', '12', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','66','132','0','','0'); -- id=93
UPDATE returnsellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where returnsellbilldetailid = 93;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 132, 126, 126, 126
                    , 126, 126, 126, 0, 2, 0, 0, 126, 126)
                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+132, returnSellCostBuyPrice = returnSellCostBuyPrice+126, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+126
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+126, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+126
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+126
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+126
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+126
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+126
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 132, 126, 126, 126
                    , 126, 126, 126, 0, 0, 126, 126)
                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+132, returnSellCostBuyPrice = returnSellCostBuyPrice+126, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+126
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+126, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+126
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+126
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+126
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+126
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+126;
UPDATE storedetail SET  productquantity = '329', userid = '1', storedetaildate = '2026-10-16 20:30:24' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '327', '329', '1', '2026-10-16 20:30:24','0','0'); -- id=4521
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 ('95.00', '00017', '21', '1', '17', '1', '98.9', '98.9', '0', '', '1', '0', '17', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','98.9','98.9','0','','0'); -- id=94
UPDATE returnsellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where returnsellbilldetailid = 94;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (17, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 98.9, 95, 95, 95
                    , 95, 95, 95, 0, 1, 0, 0, 95, 95)
                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+98.9, returnSellCostBuyPrice = returnSellCostBuyPrice+95, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+95
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+95, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+95
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+95
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+95
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+95
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+95
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 98.9, 95, 95, 95
                    , 95, 95, 95, 0, 0, 95, 95)
                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+98.9, returnSellCostBuyPrice = returnSellCostBuyPrice+95, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+95
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+95, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+95
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+95
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+95
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+95
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+95;
UPDATE storedetail SET  productquantity = '55', userid = '1', storedetaildate = '2026-10-16 20:30:24' WHERE storedetailid = '17';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('17', '1', '1', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '54', '55', '1', '2026-10-16 20:30:24','0','0'); -- id=4522
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('34.80', '00003', '21', '1', '3', '8', '36', '288', '0', '', '1', '0', '3', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','36','288','0','','0'); -- id=95
UPDATE returnsellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where returnsellbilldetailid = 95;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 288, 278.4, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 0, 8, 0, 0, 278.4, 278.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+288, returnSellCostBuyPrice = returnSellCostBuyPrice+278.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+278.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+278.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+278.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+278.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+278.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+278.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+278.4
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+8;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 288, 278.4, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 0, 0, 278.4, 278.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+288, returnSellCostBuyPrice = returnSellCostBuyPrice+278.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+278.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+278.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+278.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+278.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+278.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+278.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+278.4;
UPDATE storedetail SET  productquantity = '2767', userid = '1', storedetaildate = '2026-10-16 20:30:24' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '8', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '2759', '2767', '1', '2026-10-16 20:30:24','0','0'); -- id=4523
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', '21', '12', '87', '17', '11.3', '192.1', '0', '', '1', '0', '87', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','11.3','192.1','0','','0'); -- id=96
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 = 96;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 192.1, 188.7, 188.7, 188.7
                    , 188.7, 188.7, 188.7, 0, 17, 0, 0, 188.7, 188.7)
                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+192.1, returnSellCostBuyPrice = returnSellCostBuyPrice+188.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+188.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+188.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+188.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+188.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+188.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+188.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+188.7
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+17;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 192.1, 188.7, 188.7, 188.7
                    , 188.7, 188.7, 188.7, 0, 0, 188.7, 188.7)
                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+192.1, returnSellCostBuyPrice = returnSellCostBuyPrice+188.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+188.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+188.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+188.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+188.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+188.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+188.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+188.7;
UPDATE storedetail SET  productquantity = '146', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '17', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '129', '146', '1', '2026-10-16 20:30:25','0','0'); -- id=4524
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', '21', '12', '86', '33', '6.25', '206.25', '0', '', '1', '0', '86', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','6.25','206.25','0','','0'); -- id=97
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 = 97;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 206.25, 194.7, 194.7, 194.7
                    , 194.7, 194.7, 194.7, 0, 33, 0, 0, 194.7, 194.7)
                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+206.25, returnSellCostBuyPrice = returnSellCostBuyPrice+194.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+194.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+194.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+194.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+194.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+194.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+194.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+194.7
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+33;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 206.25, 194.7, 194.7, 194.7
                    , 194.7, 194.7, 194.7, 0, 0, 194.7, 194.7)
                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+206.25, returnSellCostBuyPrice = returnSellCostBuyPrice+194.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+194.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+194.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+194.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+194.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+194.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+194.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+194.7;
UPDATE storedetail SET  productquantity = '453', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '33', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '420', '453', '1', '2026-10-16 20:30:25','0','0'); -- id=4525
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('105.00', '00011', '21', '1', '11', '2', '109', '218', '0', '', '1', '0', '11', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','109','218','0','','0'); -- id=98
UPDATE returnsellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where returnsellbilldetailid = 98;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 218, 210, 210, 210
                    , 210, 210, 210, 0, 2, 0, 0, 210, 210)
                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+218, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+210
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+210
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+210
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 218, 210, 210, 210
                    , 210, 210, 210, 0, 0, 210, 210)
                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+218, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+210
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+210
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+210;
UPDATE storedetail SET  productquantity = '272', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '270', '272', '1', '2026-10-16 20:30:25','0','0'); -- id=4526
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('10.55', '00005', '21', '1', '5', '2', '10.95', '21.9', '0', '', '1', '0', '5', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','10.95','21.9','0','','0'); -- id=99
UPDATE returnsellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where returnsellbilldetailid = 99;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 21.9, 21.1, 21.1, 21.1
                    , 21.1, 21.1, 21.1, 0, 2, 0, 0, 21.1, 21.1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+21.9, returnSellCostBuyPrice = returnSellCostBuyPrice+21.1, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+21.1
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+21.1, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+21.1
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+21.1
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+21.1
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+21.1
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+21.1
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 21.9, 21.1, 21.1, 21.1
                    , 21.1, 21.1, 21.1, 0, 0, 21.1, 21.1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+21.9, returnSellCostBuyPrice = returnSellCostBuyPrice+21.1, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+21.1
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+21.1, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+21.1
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+21.1
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+21.1
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+21.1
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+21.1;
UPDATE storedetail SET  productquantity = '5894', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '5892', '5894', '1', '2026-10-16 20:30:25','0','0'); -- id=4527
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 ('51.77', '00116', '21', '3', '116', '12', '56', '672', '0', '', '1', '0', '116', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','56','672','0','','0'); -- id=100
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 100;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 672, 621.24, 621.24, 623.52
                    , 621.24, 623.52, 621.24, 0, 12, 0, 0, 621.24, 623.52)
                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+672, returnSellCostBuyPrice = returnSellCostBuyPrice+621.24, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+621.24
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+623.52, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+621.24
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+623.52
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+621.24
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+621.24
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+623.52
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+12;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 672, 621.24, 621.24, 623.52
                    , 621.24, 623.52, 621.24, 0, 0, 621.24, 623.52)
                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+672, returnSellCostBuyPrice = returnSellCostBuyPrice+621.24, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+621.24
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+623.52, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+621.24
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+623.52
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+621.24
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+621.24
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+623.52;
UPDATE storedetail SET  productquantity = '52', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '12', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '40', '52', '1', '2026-10-16 20:30:25','0','0'); -- id=4528
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 ('85.97', '00115', '21', '3', '115', '5', '90.5', '452.5', '0', '', '1', '0', '115', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','90.5','452.5','0','','0'); -- id=101
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 101;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 452.5, 429.85, 429.85, 436.45
                    , 429.85, 436.45, 429.85, 0, 5, 0, 0, 429.85, 436.45)
                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+452.5, returnSellCostBuyPrice = returnSellCostBuyPrice+429.85, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+429.85
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+436.45, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+429.85
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+436.45
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+429.85
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+429.85
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+436.45
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 452.5, 429.85, 429.85, 436.45
                    , 429.85, 436.45, 429.85, 0, 0, 429.85, 436.45)
                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+452.5, returnSellCostBuyPrice = returnSellCostBuyPrice+429.85, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+429.85
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+436.45, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+429.85
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+436.45
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+429.85
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+429.85
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+436.45;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '5', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '40', '45', '1', '2026-10-16 20:30:25','0','0'); -- id=4529
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 ('218.00', '00464', '21', '3', '464', '4', '229.5', '918', '0', '', '1', '0', '464', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','229.5','918','0','','0'); -- id=102
UPDATE returnsellbilldetail SET  lastbuyprice = 218.00 , meanbuyprice = 218.00, lastbuyprice_withDiscount = 218.00, meanbuyprice_withDiscount = 218.00
        , lastbuyprice_withTax = 218, meanbuyprice_withTax = 218, lastbuyprice_withDiscountAndTax = 218
                where returnsellbilldetailid = 102;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (464, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 918, 872, 872, 872
                    , 872, 872, 872, 0, 4, 0, 0, 872, 872)
                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+918, returnSellCostBuyPrice = returnSellCostBuyPrice+872, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+872
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+872, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+872
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+872
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+872
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+872
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+872
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 918, 872, 872, 872
                    , 872, 872, 872, 0, 0, 872, 872)
                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+918, returnSellCostBuyPrice = returnSellCostBuyPrice+872, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+872
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+872, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+872
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+872
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+872
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+872
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+872;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-16 20:30:25' WHERE storedetailid = '464';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('464', '1', '4', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '4', '8', '1', '2026-10-16 20:30:25','0','0'); -- id=4530
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 ('78.40', '00386', '21', '3', '386', '2', '82.5', '165', '0', '', '1', '0', '386', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','82.5','165','0','','0'); -- id=103
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 103;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 165, 156.8, 156.8, 156.8
                    , 156.8, 156.8, 156.8, 0, 2, 0, 0, 156.8, 156.8)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+165, returnSellCostBuyPrice = returnSellCostBuyPrice+156.8, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+156.8
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+156.8, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+156.8
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+156.8
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+156.8
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+156.8
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+156.8
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 165, 156.8, 156.8, 156.8
                    , 156.8, 156.8, 156.8, 0, 0, 156.8, 156.8)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+165, returnSellCostBuyPrice = returnSellCostBuyPrice+156.8, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+156.8
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+156.8, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+156.8
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+156.8
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+156.8
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+156.8
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+156.8;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-16 20:30:26' WHERE storedetailid = '386';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '34', '36', '1', '2026-10-16 20:30:26','0','0'); -- id=4531
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 ('27.00', '00118', '21', '3', '118', '2', '29', '58', '0', '', '1', '0', '118', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','29','58','0','','0'); -- id=104
UPDATE returnsellbilldetail SET  lastbuyprice = 27.00 , meanbuyprice = 27.00, lastbuyprice_withDiscount = 27.00, meanbuyprice_withDiscount = 27.00
        , lastbuyprice_withTax = 27, meanbuyprice_withTax = 27, lastbuyprice_withDiscountAndTax = 27
                where returnsellbilldetailid = 104;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (118, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 58, 54, 54, 54
                    , 54, 54, 54, 0, 2, 0, 0, 54, 54)
                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+58, returnSellCostBuyPrice = returnSellCostBuyPrice+54, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+54
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+54, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+54
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+54
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+54
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+54
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+54
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 58, 54, 54, 54
                    , 54, 54, 54, 0, 0, 54, 54)
                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+58, returnSellCostBuyPrice = returnSellCostBuyPrice+54, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+54
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+54, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+54
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+54
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+54
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+54
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+54;
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2026-10-16 20:30:26' WHERE storedetailid = '118';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('118', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '52', '54', '1', '2026-10-16 20:30:26','0','0'); -- id=4532
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 ('29.45', '00347', '21', '3', '347', '3', '31', '93', '0', '', '1', '0', '347', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','31','93','0','','0'); -- id=105
UPDATE returnsellbilldetail SET  lastbuyprice = 29.45 , meanbuyprice = 29.64, lastbuyprice_withDiscount = 29.45, meanbuyprice_withDiscount = 29.64
        , lastbuyprice_withTax = 29.45, meanbuyprice_withTax = 29.64, lastbuyprice_withDiscountAndTax = 29.45
                where returnsellbilldetailid = 105;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (347, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 93, 88.35, 88.35, 88.92
                    , 88.35, 88.92, 88.98, 0, 3, 0, 0, 88.35, 88.92)
                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+93, returnSellCostBuyPrice = returnSellCostBuyPrice+88.35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+88.35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+88.92, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+88.35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+88.92
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+88.98
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+88.35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+88.92
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 93, 88.35, 88.35, 88.92
                    , 88.35, 88.92, 88.98, 0, 0, 88.35, 88.92)
                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+93, returnSellCostBuyPrice = returnSellCostBuyPrice+88.35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+88.35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+88.92, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+88.35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+88.92
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+88.98
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+88.35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+88.92;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-16 20:30:26' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '38', '41', '1', '2026-10-16 20:30:26','0','0'); -- id=4533
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 ('17.60', '00100', '21', '3', '100', '19', '17.75', '337.25', '0', '', '1', '0', '100', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','17.75','337.25','0','','0'); -- id=106
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 106;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 337.25, 334.4, 334.4, 334.4
                    , 334.4, 334.4, 334.4, 0, 19, 0, 0, 334.4, 334.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+337.25, returnSellCostBuyPrice = returnSellCostBuyPrice+334.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+334.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+334.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+334.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+334.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+334.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+334.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+334.4
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+19;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 337.25, 334.4, 334.4, 334.4
                    , 334.4, 334.4, 334.4, 0, 0, 334.4, 334.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+337.25, returnSellCostBuyPrice = returnSellCostBuyPrice+334.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+334.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+334.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+334.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+334.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+334.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+334.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+334.4;
UPDATE storedetail SET  productquantity = '634', userid = '1', storedetaildate = '2026-10-16 20:30:26' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '19', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '615', '634', '1', '2026-10-16 20:30:26','0','0'); -- id=4534
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 ('37.00', '00117', '21', '3', '117', '6', '39', '234', '0', '', '1', '0', '117', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','39','234','0','','0'); -- id=107
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 107;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 234, 222, 222, 222
                    , 222, 222, 222, 0, 6, 0, 0, 222, 222)
                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+234, returnSellCostBuyPrice = returnSellCostBuyPrice+222, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+222
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+222, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+222
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+222
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+222
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+222
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+222
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+6;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 234, 222, 222, 222
                    , 222, 222, 222, 0, 0, 222, 222)
                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+234, returnSellCostBuyPrice = returnSellCostBuyPrice+222, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+222
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+222, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+222
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+222
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+222
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+222
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+222;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-16 20:30:27' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '6', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '15', '21', '1', '2026-10-16 20:30:27','0','0'); -- id=4535
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 ('35.00', '00343', '21', '6', '343', '2', '40', '80', '0', '', '1', '0', '343', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','40','80','0','','0'); -- id=108
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 108;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 80, 70, 70, 70
                    , 70, 70, 70, 0, 2, 0, 0, 70, 70)
                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+80, returnSellCostBuyPrice = returnSellCostBuyPrice+70, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+70
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+70, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+70
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+70
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+70
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+70
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+70
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 80, 70, 70, 70
                    , 70, 70, 70, 0, 0, 70, 70)
                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+80, returnSellCostBuyPrice = returnSellCostBuyPrice+70, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+70
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+70, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+70
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+70
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+70
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+70
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+70;
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2026-10-16 20:30:27' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '24', '26', '1', '2026-10-16 20:30:27','0','0'); -- id=4536
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 ('6.50', '00315', '21', '6', '315', '5', '8', '40', '0', '', '1', '0', '315', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','8','40','0','','0'); -- id=109
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 109;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 40, 32.5, 32.5, 32.5
                    , 32.5, 32.5, 32.5, 0, 5, 0, 0, 32.5, 32.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+40, returnSellCostBuyPrice = returnSellCostBuyPrice+32.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+32.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+32.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+32.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+32.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+32.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+32.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+32.5
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 40, 32.5, 32.5, 32.5
                    , 32.5, 32.5, 32.5, 0, 0, 32.5, 32.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+40, returnSellCostBuyPrice = returnSellCostBuyPrice+32.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+32.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+32.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+32.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+32.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+32.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+32.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+32.5;
UPDATE storedetail SET  productquantity = '588', userid = '1', storedetaildate = '2026-10-16 20:30:27' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '5', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '583', '588', '1', '2026-10-16 20:30:27','0','0'); -- id=4537
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 ('41.28', '00187', '21', '20', '187', '2', '48', '96', '0', '', '1', '0', '187', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','48','96','0','','0'); -- id=110
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 110;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 96, 82.56, 82.56, 82.56
                    , 82.56, 82.56, 82.56, 0, 2, 0, 0, 82.56, 82.56)
                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+96, returnSellCostBuyPrice = returnSellCostBuyPrice+82.56, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+82.56
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+82.56, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+82.56
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+82.56
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+82.56
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+82.56
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+82.56
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 96, 82.56, 82.56, 82.56
                    , 82.56, 82.56, 82.56, 0, 0, 82.56, 82.56)
                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+96, returnSellCostBuyPrice = returnSellCostBuyPrice+82.56, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+82.56
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+82.56, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+82.56
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+82.56
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+82.56
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+82.56
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+82.56;
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2026-10-16 20:30:27' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '2', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '100', '102', '1', '2026-10-16 20:30:27','0','0'); -- id=4538
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', '21', '3', '111', '3', '120', '360', '0', '', '1', '0', '111', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','120','360','0','','0'); -- id=111
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 = 111;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 348, 348, 348
                    , 348, 348, 348, 0, 3, 0, 0, 348, 348)
                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+360, returnSellCostBuyPrice = returnSellCostBuyPrice+348, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+348
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+348, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+348
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+348
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+348
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+348
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+348
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 348, 348, 348
                    , 348, 348, 348, 0, 0, 348, 348)
                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+360, returnSellCostBuyPrice = returnSellCostBuyPrice+348, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+348
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+348, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+348
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+348
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+348
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+348
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+348;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-10-16 20:30:28' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '3', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '43', '46', '1', '2026-10-16 20:30:28','0','0'); -- id=4539
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('34.00', '00169', '21', '2', '169', '3', '50', '150', '0', '', '1', '0', '169', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','50','150','0','','0'); -- id=112
UPDATE returnsellbilldetail SET  lastbuyprice = 34.00 , meanbuyprice = 34.00, lastbuyprice_withDiscount = 34.00, meanbuyprice_withDiscount = 34.00
        , lastbuyprice_withTax = 34, meanbuyprice_withTax = 34, lastbuyprice_withDiscountAndTax = 34
                where returnsellbilldetailid = 112;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (169, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 150, 102, 102, 102
                    , 102, 102, 102, 0, 3, 0, 0, 102, 102)
                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+150, returnSellCostBuyPrice = returnSellCostBuyPrice+102, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+102
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+102, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+102
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+102
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+102
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+102
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+102
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 150, 102, 102, 102
                    , 102, 102, 102, 0, 0, 102, 102)
                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+150, returnSellCostBuyPrice = returnSellCostBuyPrice+102, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+102
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+102, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+102
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+102
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+102
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+102
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+102;
UPDATE storedetail SET  productquantity = '188', userid = '1', storedetaildate = '2026-10-16 20:30:28' WHERE storedetailid = '169';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('169', '1', '3', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '185', '188', '1', '2026-10-16 20:30:28','0','0'); -- id=4540
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 ('17.60', '00101', '21', '3', '101', '16', '17.75', '284', '0', '', '1', '0', '101', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','17.75','284','0','','0'); -- id=113
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 113;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 284, 281.6, 281.6, 281.6
                    , 281.6, 281.6, 281.6, 0, 16, 0, 0, 281.6, 281.6)
                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+284, returnSellCostBuyPrice = returnSellCostBuyPrice+281.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+281.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+281.6, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+281.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+281.6
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+281.6
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+281.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+281.6
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+16;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 284, 281.6, 281.6, 281.6
                    , 281.6, 281.6, 281.6, 0, 0, 281.6, 281.6)
                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+284, returnSellCostBuyPrice = returnSellCostBuyPrice+281.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+281.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+281.6, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+281.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+281.6
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+281.6
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+281.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+281.6;
UPDATE storedetail SET  productquantity = '631', userid = '1', storedetaildate = '2026-10-16 20:30:28' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '16', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '615', '631', '1', '2026-10-16 20:30:28','0','0'); -- id=4541
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 ('35.00', '00297', '21', '6', '297', '1', '40', '40', '0', '', '1', '0', '297', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','40','40','0','','0'); -- id=114
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 114;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (297, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 40, 35, 35, 35
                    , 35, 35, 35, 0, 1, 0, 0, 35, 35)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+40, returnSellCostBuyPrice = returnSellCostBuyPrice+35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+35, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+35
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+35
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+35
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 40, 35, 35, 35
                    , 35, 35, 35, 0, 0, 35, 35)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+40, returnSellCostBuyPrice = returnSellCostBuyPrice+35, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+35
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+35, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+35
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+35
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+35
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+35
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+35;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-16 20:30:28' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '1', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '6', '7', '1', '2026-10-16 20:30:28','0','0'); -- id=4542
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('11.75', '00102', '21', '3', '102', '41', '12', '492', '0', '', '1', '0', '102', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','12','492','0','','0'); -- id=115
UPDATE returnsellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where returnsellbilldetailid = 115;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 492, 481.75, 481.75, 481.75
                    , 481.75, 481.75, 481.75, 0, 41, 0, 0, 481.75, 481.75)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+492, returnSellCostBuyPrice = returnSellCostBuyPrice+481.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+481.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+481.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+481.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+481.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+481.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+481.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+481.75
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+41;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 492, 481.75, 481.75, 481.75
                    , 481.75, 481.75, 481.75, 0, 0, 481.75, 481.75)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+492, returnSellCostBuyPrice = returnSellCostBuyPrice+481.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+481.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+481.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+481.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+481.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+481.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+481.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+481.75;
UPDATE storedetail SET  productquantity = '745', userid = '1', storedetaildate = '2026-10-16 20:30:29' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '41', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '704', '745', '1', '2026-10-16 20:30:29','0','0'); -- id=4543
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 ('17.85', '00599', '21', '6', '599', '15', '19', '285', '0', '', '1', '0', '599', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','19','285','0','','0'); -- id=116
UPDATE returnsellbilldetail SET  lastbuyprice = 17.85 , meanbuyprice = 17.85, lastbuyprice_withDiscount = 17.85, meanbuyprice_withDiscount = 17.85
        , lastbuyprice_withTax = 17.85, meanbuyprice_withTax = 17.85, lastbuyprice_withDiscountAndTax = 17.85
                where returnsellbilldetailid = 116;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (599, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 285, 267.75, 267.75, 267.75
                    , 267.75, 267.75, 267.75, 0, 15, 0, 0, 267.75, 267.75)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+285, returnSellCostBuyPrice = returnSellCostBuyPrice+267.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+267.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+267.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+267.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+267.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+267.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+267.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+267.75
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+15;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 285, 267.75, 267.75, 267.75
                    , 267.75, 267.75, 267.75, 0, 0, 267.75, 267.75)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+285, returnSellCostBuyPrice = returnSellCostBuyPrice+267.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+267.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+267.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+267.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+267.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+267.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+267.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+267.75;
UPDATE storedetail SET  productquantity = '215', userid = '1', storedetaildate = '2026-10-16 20:30:29' WHERE storedetailid = '599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('599', '1', '15', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '200', '215', '1', '2026-10-16 20:30:29','0','0'); -- id=4544
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('4.50', '00103', '21', '3', '103', '112', '5.5', '616', '0', '', '1', '0', '103', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','5.5','616','0','','0'); -- id=117
UPDATE returnsellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where returnsellbilldetailid = 117;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 616, 504, 504, 504
                    , 504, 504, 504, 0, 112, 0, 0, 504, 504)
                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+616, returnSellCostBuyPrice = returnSellCostBuyPrice+504, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+504
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+504, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+504
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+504
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+504
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+504
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+504
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+112;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 616, 504, 504, 504
                    , 504, 504, 504, 0, 0, 504, 504)
                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+616, returnSellCostBuyPrice = returnSellCostBuyPrice+504, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+504
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+504, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+504
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+504
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+504
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+504
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+504;
UPDATE storedetail SET  productquantity = '2240', userid = '1', storedetaildate = '2026-10-16 20:30:29' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '112', '0', '21', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '2128', '2240', '1', '2026-10-16 20:30:29','0','0'); -- id=4545
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-810851.825',  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 ('-803387.125','-7464.7', '1', '1', 'اضافة فاتورة مردوات مبيعات', '21', '-810851.825', '2026-10-16 20:30:29', '1',  'returnsellbillController.php','1','','0'); -- id=329
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7464.7', '7464.7', '2026-10-16', '1', '0', '0', '2026-10-16 20:30:29','اضافة فاتورة مردود مبيعات رقم 21','1','0',null,'0','21','returnsellbillController.php?do=showDetail&returnsellbillid=21'); -- id=1664
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1664', '143', '7464.7', '','0'); -- id=1679
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1331227', 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 ('1664', '383', '7464.7', '','0'); -- id=1668
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '32481.4', 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 dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6997.6', '6997.6', '2026-10-16', '1', '0', '0', '2026-10-16 20:30:29','اضافة فاتورة مردود مبيعات رقم 21 - صرف البضاعة من المخزن','1','0',null,'0','21','returnsellbillController.php?do=showDetail&returnsellbillid=21'); -- id=1665
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1665', '382', '6997.6', '','0'); -- id=1680
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2317744.16', 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 ('1665', '402', '6997.6', '','0'); -- id=1669
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1190729.93', 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='1664,0,1665' where returnsellbillid=21;
 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 7464.7, 6997.6, 6997.6, 7007.05
                    , 6997.6, 7007.05, 6998.23 ,0, 0, 6997.6, 7007.05)
                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+7464.7, returnSellCostBuyPrice = returnSellCostBuyPrice+6997.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+6997.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+7007.05, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+6997.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+7007.05
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+6998.23
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+6997.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+7007.05;
 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 7464.7, 6997.6, 6997.6, 7007.05
                    , 6997.6, 7007.05, 6998.23 ,0, 0, 6997.6, 7007.05)
                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+7464.7, returnSellCostBuyPrice = returnSellCostBuyPrice+6997.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+6997.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+7007.05, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+6997.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+7007.05
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+6998.23
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+6997.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+7007.05;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -7464.7, -6997.6, -6997.6
                    , -7007.05, -6997.6, -7007.05, -6998.23, -6997.6, -7007.05)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-7464.7, netSellCostBuyPrice = netSellCostBuyPrice+-6997.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-6997.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-7007.05
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-6997.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-7007.05
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-6998.23
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-6997.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-7007.05;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad2696fb4529 and sellbillId = 21 and returnsellbillId = 21
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:00:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:30:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:30:32', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4374
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:06:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:36:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:36:18', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4375
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:00', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4376

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad26ea311f2b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(48,@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-16 20:38:00', '06ad26ea311f2b', '48', '3530.00', '2848.6', '0', '1', '681.4', '681.4', '0', '-681.4', '1', '2026-10-16 20:38:00', '', '1', '0', 'يوسف فضل','1', '1', '5', '0', 'يوسف فضل', '34', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=22
UPDATE client SET  clientdebt = '2848.6', userid = '1' WHERE clientid = '48';
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 ('48','3530.00','681.4','1','اضافة فاتورة مردوات مبيعات','22', '2848.6', '2026-10-16 20:38:01', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '681.4', '0', null, '0', null, null,'', '0','1','1','681.4','1','2026-10-16 20:38:00','0','0','',''); -- id=530
UPDATE client SET  inUse = 0 where clientid = 48;
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 ('26.50', '00437', '22', '10', '437', '20', '30', '600', '0', '', '1', '0', '437', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','30','600','0','','0'); -- id=118
UPDATE returnsellbilldetail SET  lastbuyprice = 26.50 , meanbuyprice = 26.50, lastbuyprice_withDiscount = 26.50, meanbuyprice_withDiscount = 26.50
        , lastbuyprice_withTax = 26.5, meanbuyprice_withTax = 26.5, lastbuyprice_withDiscountAndTax = 26.5
                where returnsellbilldetailid = 118;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (437, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 600, 530, 530, 530
                    , 530, 530, 530, 0, 20, 0, 0, 530, 530)
                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+600, returnSellCostBuyPrice = returnSellCostBuyPrice+530, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+530
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+530, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+530
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+530
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+530
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+530
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+530
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+20;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 600, 530, 530, 530
                    , 530, 530, 530, 0, 0, 530, 530)
                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+600, returnSellCostBuyPrice = returnSellCostBuyPrice+530, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+530
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+530, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+530
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+530
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+530
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+530
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+530;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-10-16 20:38:01' WHERE storedetailid = '437';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('437', '1', '20', '0', '22', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '90', '110', '1', '2026-10-16 20:38:01','0','0'); -- id=4546
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', '22', '12', '87', '2', '11.3', '22.6', '0', '', '1', '0', '87', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','11.3','22.6','0','','0'); -- id=119
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 = 119;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 22.6, 22.2, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 0, 2, 0, 0, 22.2, 22.2)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+22.6, returnSellCostBuyPrice = returnSellCostBuyPrice+22.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+22.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+22.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+22.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+22.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+22.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+22.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+22.2
                        , 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 22.6, 22.2, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 0, 0, 22.2, 22.2)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+22.6, returnSellCostBuyPrice = returnSellCostBuyPrice+22.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+22.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+22.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+22.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+22.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+22.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+22.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+22.2;
UPDATE storedetail SET  productquantity = '148', userid = '1', storedetaildate = '2026-10-16 20:38:01' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '2', '0', '22', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '146', '148', '1', '2026-10-16 20:38:01','0','0'); -- id=4547
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('4.50', '00089', '22', '12', '89', '12', '4.9', '58.8', '0', '', '1', '0', '89', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','4.9','58.8','0','','0'); -- id=120
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 120;
 INSERT INTO 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 58.8, 54, 48, 51
                    , 48, 51, 48, 0, 12, 0, 0, 51, 51)
                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+58.8, returnSellCostBuyPrice = returnSellCostBuyPrice+54, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+48
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+51, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+48
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+51
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+48
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+51
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+51
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+12;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 58.8, 54, 48, 51
                    , 48, 51, 48, 0, 0, 51, 51)
                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+58.8, returnSellCostBuyPrice = returnSellCostBuyPrice+54, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+48
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+51, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+48
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+51
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+48
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+51
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+51;
UPDATE storedetail SET  productquantity = '151', userid = '1', storedetaildate = '2026-10-16 20:38:01' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '12', '0', '22', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '139', '151', '1', '2026-10-16 20:38:01','0','0'); -- id=4548
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '681.4', '681.4', '2026-10-16', '1', '0', '0', '2026-10-16 20:38:01','اضافة فاتورة مردود مبيعات رقم 22','1','0',null,'0','22','returnsellbillController.php?do=showDetail&returnsellbillid=22'); -- id=1666
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1666', '143', '681.4', '','0'); -- id=1681
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1330545.6', 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 ('1666', '481', '681.4', '','0'); -- id=1670
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '2848.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '600.2', '600.2', '2026-10-16', '1', '0', '0', '2026-10-16 20:38:01','اضافة فاتورة مردود مبيعات رقم 22 - صرف البضاعة من المخزن','1','0',null,'0','22','returnsellbillController.php?do=showDetail&returnsellbillid=22'); -- id=1667
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1667', '382', '600.2', '','0'); -- id=1682
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2318344.36', 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 ('1667', '402', '600.2', '','0'); -- id=1671
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1190129.73', 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='1666,0,1667' where returnsellbillid=22;
 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-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 681.4, 606.2, 600.2, 603.2
                    , 600.2, 603.2, 600.2 ,0, 0, 603.2, 603.2)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+681.4, returnSellCostBuyPrice = returnSellCostBuyPrice+606.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+600.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+603.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+600.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+603.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+600.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+603.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+603.2;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-16', 0, 0, 0
                    , 0, 0, 0, 0
                    , 681.4, 606.2, 600.2, 603.2
                    , 600.2, 603.2, 600.2 ,0, 0, 603.2, 603.2)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+681.4, returnSellCostBuyPrice = returnSellCostBuyPrice+606.2, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+600.2
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+603.2, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+600.2
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+603.2
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+600.2
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+603.2
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+603.2;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -681.4, -606.2, -600.2
                    , -603.2, -600.2, -603.2, -600.2, -603.2, -603.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-681.4, netSellCostBuyPrice = netSellCostBuyPrice+-606.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-600.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-603.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-600.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-603.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-600.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-603.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-603.2;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad26ea311f2b and sellbillId = 22 and returnsellbillId = 22
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4377
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:12', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4378
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4379
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:27', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=273'); -- id=4380
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:39', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4381
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 273;
UPDATE sellbill SET  sellbillsysdate = '2026-10-16 20:38:39', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '273';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 110;
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1067.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1067.00
        , lastbuyprice_withTax = 1071.5, meanbuyprice_withTax = 1067, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 2233;
 INSERT INTO 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-16', 1230, 1103, 1040
                    , 1067, 1040, 1067, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1071.5, 1067, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1230, sellCostBuyPrice =sellCostBuyPrice-1103
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1067
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1067
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1071.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1067
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-16', 1230, 1103, 1040
                    , 1067, 1040, 1067, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1071.5, 1067, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1230, sellCostBuyPrice =sellCostBuyPrice-1103
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1067
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1067
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1071.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1067
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-16 20:38:39' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '1', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '69', '70', '1', '2026-10-11 20:44:54','0','0'); -- id=4549
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 102;
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 2234;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (70, '2026-10-16', 410, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-410, sellCostBuyPrice =sellCostBuyPrice-348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-348, sellCostMeanBuyPrice = sellCostMeanBuyPrice-332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-332.81
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-16', 410, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-410, sellCostBuyPrice =sellCostBuyPrice-348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-348, sellCostMeanBuyPrice = sellCostMeanBuyPrice-332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-332.81
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-16 20:38:39' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '1', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '59', '60', '1', '2026-10-11 20:44:54','0','0'); -- id=4550
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 2235;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (215, '2026-10-16', 385, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-385, sellCostBuyPrice =sellCostBuyPrice-375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-375, sellCostMeanBuyPrice = sellCostMeanBuyPrice-375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-375
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-16', 385, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-385, sellCostBuyPrice =sellCostBuyPrice-375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-375, sellCostMeanBuyPrice = sellCostMeanBuyPrice-375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-375
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-16 20:38:40' WHERE storedetailid = '215';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('215', '1', '1', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '5', '1', '2026-10-11 20:44:54','0','0'); -- id=4551
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 = 2236;
 INSERT INTO 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-16', 45.2, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45.2, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 45.2, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45.2, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.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 = '152', userid = '1', storedetaildate = '2026-10-16 20:38:40' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '4', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '148', '152', '1', '2026-10-11 20:44:54','0','0'); -- id=4552
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 = 2237;
 INSERT INTO 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-16', 98, 90, 80
                    , 85, 80, 85, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 85, 85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-98, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-80, sellCostMeanBuyPrice = sellCostMeanBuyPrice-85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-85
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 98, 90, 80
                    , 85, 80, 85, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 85, 85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-98, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-80, sellCostMeanBuyPrice = sellCostMeanBuyPrice-85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-85
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '171', userid = '1', storedetaildate = '2026-10-16 20:38:40' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '20', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '151', '171', '1', '2026-10-11 20:44:54','0','0'); -- id=4553
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 = 2238;
 INSERT INTO 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-16', 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-16', 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 = '91', userid = '1', storedetaildate = '2026-10-16 20:38:40' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '90', '91', '1', '2026-10-11 20:44:54','0','0'); -- id=4554
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 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 = 2239;
 INSERT INTO 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-16', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-68, sellCostBuyPrice =sellCostBuyPrice-61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-61.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-68, sellCostBuyPrice =sellCostBuyPrice-61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-61.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '292', userid = '1', storedetaildate = '2026-10-16 20:38:40' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '273', 'تعديل فاتورة مبيعات', 'sellbillController.php', '290', '292', '1', '2026-10-11 20:44:54','0','0'); -- id=4555
CALL clientInUse(48,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '2848.6', userid = '1' WHERE clientid = '48';
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 ('48','2848.60','0.00','1','تعديل فاتورة مبيعات','273', '2848.6', '2026-10-11 20:44:54', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2255.2', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-11 20:44:54','0','0','',''); -- id=531
UPDATE client SET  inUse = 0 where clientid = 48;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-813107.0125',  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 ('-810851.8125','2255.2', '1', '1', 'تعديل فاتورة مبيعات', '273', '-813107.0125', '2026-10-16 20:38:40', '1',  'sellbillController.php','48','','0'); -- id=330
 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-16', 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2003.5, 1983.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2255.2, sellCostBuyPrice =sellCostBuyPrice-2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1967, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1983.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1967, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1983.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2003.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1983.81
                        , returnSellVal = returnSellVal-0, 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 (48, '2026-10-16', 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2003.5, 1983.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2255.2, sellCostBuyPrice =sellCostBuyPrice-2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1967, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1983.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1967, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1983.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2003.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1983.81
                        , returnSellVal = returnSellVal-0, 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, 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959, 2003.5, 1983.81)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2255.2, netSellCostBuyPrice = netSellCostBuyPrice-2040
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-1967
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-1983.81
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-1967
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-1983.81
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-1959
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2003.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-1983.81;

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


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

COMMIT;
BEGIN;
CALL clientInUse(48,@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-11 20:44:54', '06acbd8977a882', '48', '2848.60', '2848.6', '0', '1', '2255.2', '2255.2', '2255.2', '0', '1', '2026-10-11 20:44:54', '', '1', '0', 'يوسف فضل', '1', '1', '3', '0', 'يوسف فضل', '30', '273', 'sellbillController', '0','','','','','-1','0','0','2255.2','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-11','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=312
UPDATE client SET  clientdebt = '2848.6', userid = '1' WHERE clientid = '48';
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 ('48','2848.60','0','0','اضافة فاتورة مبيعات (معدله)','312', '2848.6', '2026-10-16 20:38:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2255.2', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-11 20:44:54','0','0','',''); -- id=532
UPDATE client SET  inUse = 0 where clientid = 48;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 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', '312', '10', '208', '1.00', '1230', '1230', '0', '', '1', '2026-10-16 20:38:41', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-1,','1','1','0','0','1230','1230','0','','0','0.00','0','0','0','0'); -- id=2508
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1067.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1067.00
        , lastbuyprice_withTax = 1071.5, meanbuyprice_withTax = 1067, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 2508;
 INSERT INTO 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-16', 1230, 1103, 1040
                    , 1067, 1040, 1067, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1071.5, 1067, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1103
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1067
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1067
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1071.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1067
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 1230, 1103, 1040
                    , 1067, 1040, 1067, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1071.5, 1067, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1103
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1067
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1067
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1071.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1067
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '1', storedetaildate = '2026-10-16 20:38:41' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '1', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '70', '69', '1', '2026-10-16 20:38:41','0','0'); -- id=4556
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 102;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('348','00070', '312', '12', '70', '1.00', '410', '410', '0', '', '1', '2026-10-16 20:38:41', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','102-1,','1','1','0','0','410','410','0','','0','0.00','0','0','0','0'); -- id=2509
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 2509;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (70, '2026-10-16', 410, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+332.81
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 410, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+332.81
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 20:38:41' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '1', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '60', '59', '1', '2026-10-16 20:38:41','0','0'); -- id=4557
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('375','00215', '312', '13', '215', '1.00', '385', '385', '0', '', '1', '2026-10-16 20:38:41', '215', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','385','385','0','','0','0.00','0','0','0','0'); -- id=2510
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 375.00, meanbuyprice_withDiscount = 375.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 375
                where sellbilldetailid = 2510;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (215, '2026-10-16', 385, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-16', 385, 375, 375
                    , 375, 375, 375, 375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 375, 375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+385, sellCostBuyPrice =sellCostBuyPrice+375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-16 20:38:42' WHERE storedetailid = '215';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('215', '1', '1', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '4', '1', '2026-10-16 20:38:42','0','0'); -- id=4558
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '312', '12', '87', '4.00', '11.3', '45.2', '0', '', '1', '2026-10-16 20:38:42', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','45.2','0','','0','0.00','0','0','0','0'); -- id=2511
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 = 2511;
 INSERT INTO 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-16', 45.2, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45.2, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 45.2, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45.2, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.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 = '148', userid = '1', storedetaildate = '2026-10-16 20:38:42' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '4', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '152', '148', '1', '2026-10-16 20:38:42','0','0'); -- id=4559
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '312', '12', '89', '20.00', '4.9', '98', '0', '', '1', '2026-10-16 20:38:42', '89', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4.9','98','0','','0','0.00','0','0','0','0'); -- id=2512
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 = 2512;
 INSERT INTO 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-16', 98, 90, 80
                    , 85, 80, 85, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 85, 85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+98, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 98, 90, 80
                    , 85, 80, 85, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 85, 85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+98, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '151', userid = '1', storedetaildate = '2026-10-16 20:38:42' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '20', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '171', '151', '1', '2026-10-16 20:38:42','0','0'); -- id=4560
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '312', '14', '81', '1.00', '19', '19', '0', '', '1', '2026-10-16 20:38:42', '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=2513
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 = 2513;
 INSERT INTO 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-16', 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-16', 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 = '90', userid = '1', storedetaildate = '2026-10-16 20:38:42' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '91', '90', '1', '2026-10-16 20:38:42','0','0'); -- id=4561
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '312', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-10-16 20:38:42', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-2,','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=2514
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 = 2514;
 INSERT INTO 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-16', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+61.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 68, 61.6, 61.6
                    , 61.6, 61.6, 61.6, 61.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 61.6, 61.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+61.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+61.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+61.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+61.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+61.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+61.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+61.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+61.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '290', userid = '1', storedetaildate = '2026-10-16 20:38:42' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '312', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '292', '290', '1', '2026-10-16 20:38:42','0','0'); -- id=4562
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-810851.8',  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 ('-813107','2255.2', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '312', '-810851.8', '2026-10-16 20:38:42', '1',  'sellbillController.php','48','','0'); -- id=331
UPDATE dailyentry SET totalcreditor = '2255.20', totaldebtor = '2255.20', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 20:44:57', entryComment = 'اضافة فاتورة مبيعات رقم 273', fromFlag = '1',related='0',isopeningentry='0',operationId='273',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=273' WHERE id = '1517';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2255.20', '2255.20', '2026-10-16', '1', '0', '1517', '2026-10-16 20:38:43','تم عكس القيد رقم 1517 ','1','0','0','0','0',''); -- id=1668
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1668', '481', '2255.20', '','0'); -- id=1672
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '593.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1668', '143', '2255.20', '','0'); -- id=1683
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1328290.4', 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 = '2255.20', totaldebtor = '2255.20', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 20:44:57', entryComment = 'اضافة فاتورة مبيعات رقم 273 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='273',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=273' WHERE id = '1518';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2255.20', '2255.20', '2026-10-16', '1', '0', '1518', '2026-10-16 20:38:43','تم عكس القيد رقم 1518 ','1','0','0','0','0',''); -- id=1669
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1669', '383', '2255.20', '','0'); -- id=1673
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '30226.2', 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 ('1669', '481', '2255.20', '','0'); -- id=1684
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '2848.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
UPDATE dailyentry SET totalcreditor = '1967.00', totaldebtor = '1967.00', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 20:44:57', entryComment = 'اضافة فاتورة مبيعات رقم 273 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='273',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=273' WHERE id = '1519';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1967.00', '1967.00', '2026-10-16', '1', '0', '1519', '2026-10-16 20:38:43','تم عكس القيد رقم 1519 ','1','0','0','0','0',''); -- id=1670
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1670', '402', '1967.00', '','0'); -- id=1674
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1188162.73', 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 ('1670', '382', '1967.00', '','0'); -- id=1685
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2320311.36', 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 ( '2255.2', '2255.2', '2026-10-16', '1', '0', '0', '2026-10-16 20:38:44','اضافة فاتورة مبيعات رقم 312','1','0',null,'0','312','sellbillController.php?do=showDetail&sellbillid=312'); -- id=1671
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1671', '481', '2255.2', '','0'); -- id=1686
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '5103.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1671', '143', '2255.2', '','0'); -- id=1675
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1330545.6', 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 ( '2255.2', '2255.2', '2026-10-16', '1', '0', '0', '2026-10-16 20:38:44','اضافة فاتورة مبيعات رقم 312 - تحصيل الفاتورة من العميل','1','0',null,'0','312','sellbillController.php?do=showDetail&sellbillid=312'); -- id=1672
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1672', '383', '2255.2', '','0'); -- id=1687
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '32481.4', 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 ('1672', '481', '2255.2', '','0'); -- id=1676
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '2848.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1967', '1967', '2026-10-16', '1', '0', '0', '2026-10-16 20:38:44','اضافة فاتورة مبيعات رقم 312 - صرف البضاعة من المخزن','1','0',null,'0','312','sellbillController.php?do=showDetail&sellbillid=312'); -- id=1673
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1673', '402', '1967', '','0'); -- id=1688
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1190129.73', 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 ('1673', '382', '1967', '','0'); -- id=1677
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2318344.36', 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='1671,1672,1673' where sellbillid=312;
 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-16', 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2003.5, 1983.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2255.2, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1967, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1983.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1967, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1983.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2003.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1983.81
                        , returnSellVal = returnSellVal+0, 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 (48, '2026-10-16', 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2003.5, 1983.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2255.2, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1967, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1983.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1967, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1983.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2003.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1983.81
                        , returnSellVal = returnSellVal+0, 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, 2255.2, 2040, 1967
                    , 1983.81, 1967, 1983.81, 1959, 2003.5, 1983.81)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2255.2, netSellCostBuyPrice = netSellCostBuyPrice+2040
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1967
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1983.81
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1967
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1983.81
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1959
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2003.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1983.81;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 273 and newid=312 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:45', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=312'); -- id=4382
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:08:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:38:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:38:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4383
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:09:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:39:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:39:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4384
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:09:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:39:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:39:08', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=280'); -- id=4385
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:09:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:39:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:39:14', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4386
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 280;
UPDATE sellbill SET  sellbillsysdate = '2026-10-16 20:39:15', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '280';
UPDATE sellbilldetail SET  lastbuyprice = 2600.00 , meanbuyprice = 2692.50, lastbuyprice_withDiscount = 2600.00, meanbuyprice_withDiscount = 2692.50
        , lastbuyprice_withTax = 2692.5, meanbuyprice_withTax = 2692.5, lastbuyprice_withDiscountAndTax = 2600
                where sellbilldetailid = 2266;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (252, '2026-10-16', 3050, 2785, 2600
                    , 2692.5, 2600, 2692.5, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2692.5, 2692.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3050, sellCostBuyPrice =sellCostBuyPrice-2785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2692.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2692.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2692.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2692.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-16', 3050, 2785, 2600
                    , 2692.5, 2600, 2692.5, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2692.5, 2692.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3050, sellCostBuyPrice =sellCostBuyPrice-2785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2692.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2692.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2692.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2692.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 = '18', userid = '1', storedetaildate = '2026-10-16 20:39:15' WHERE storedetailid = '252';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('252', '1', '1', '0', '280', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '18', '1', '2026-10-12 14:37:39','0','0'); -- id=4563
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 = 2267;
 INSERT INTO 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-16', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-420, sellCostMeanBuyPrice = sellCostMeanBuyPrice-420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-420
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-420, sellCostMeanBuyPrice = sellCostMeanBuyPrice-420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-420
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-16 20:39:15' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '20', '0', '280', 'تعديل فاتورة مبيعات', 'sellbillController.php', '75', '95', '1', '2026-10-12 14:37:39','0','0'); -- id=4564
CALL clientInUse(48,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-681.4', userid = '1' WHERE clientid = '48';
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 ('48','2848.60','3530.00','1','تعديل فاتورة مبيعات','280', '-681.4', '2026-10-12 14:37:39', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3530', '0', null, '0', null, null,'', '0','1','1','3530','1','2026-10-12 14:37:39','0','0','',''); -- id=533
UPDATE client SET  inUse = 0 where clientid = 48;
 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-16', 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3112.5, 3112.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3530, sellCostBuyPrice =sellCostBuyPrice-3205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3020, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3112.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3112.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3112.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3112.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-16', 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3112.5, 3112.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3530, sellCostBuyPrice =sellCostBuyPrice-3205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3020, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3112.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3112.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3112.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3112.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020, 3112.5, 3112.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3530, netSellCostBuyPrice = netSellCostBuyPrice-3205
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3020
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3112.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3020
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3112.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3020
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3112.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3112.5;

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


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

COMMIT;
BEGIN;
CALL clientInUse(48,@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-12 14:37:39', '06accd446a8adc', '48', '-681.40', '2848.6', '0', '1', '3530', '3530', '0', '3530', '1', '2026-10-12 14:37:39', '', '1', '0', 'يوسف فضل', '1', '1', '3', '0', 'يوسف فضل', '21', '280', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-12','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=313
UPDATE client SET  clientdebt = '2848.6', userid = '1' WHERE clientid = '48';
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 ('48','-681.40','3530','0','اضافة فاتورة مبيعات (معدله)','313', '2848.6', '2026-10-16 20:39:16', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '3530', '0', null, '0', null, null,'', '0','1','1','3530','1','2026-10-12 14:37:39','0','0','',''); -- id=534
UPDATE client SET  inUse = 0 where clientid = 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 ('2785','00252', '313', '10', '252', '1.00', '3050', '3050', '0', '', '1', '2026-10-16 20:39:16', '252', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3050','3050','0','','0','0.00','0','0','0','0'); -- id=2515
UPDATE sellbilldetail SET  lastbuyprice = 2600.00 , meanbuyprice = 2692.50, lastbuyprice_withDiscount = 2600.00, meanbuyprice_withDiscount = 2692.50
        , lastbuyprice_withTax = 2692.5, meanbuyprice_withTax = 2692.5, lastbuyprice_withDiscountAndTax = 2600
                where sellbilldetailid = 2515;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (252, '2026-10-16', 3050, 2785, 2600
                    , 2692.5, 2600, 2692.5, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2692.5, 2692.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2692.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2692.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2692.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2692.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-16', 3050, 2785, 2600
                    , 2692.5, 2600, 2692.5, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2692.5, 2692.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2692.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2692.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2692.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2692.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 = '17', userid = '1', storedetaildate = '2026-10-16 20:39:16' WHERE storedetailid = '252';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('252', '1', '1', '1', '313', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '18', '17', '1', '2026-10-16 20:39:16','0','0'); -- id=4565
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '313', '10', '417', '20.00', '24', '480', '0', '', '1', '2026-10-16 20:39:16', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','24','480','0','','0','0.00','0','0','0','0'); -- id=2516
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 = 2516;
 INSERT INTO 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-16', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-16', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '1', storedetaildate = '2026-10-16 20:39:16' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '20', '1', '313', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '95', '75', '1', '2026-10-16 20:39:16','0','0'); -- id=4566
UPDATE dailyentry SET totalcreditor = '3530.00', totaldebtor = '3530.00', thedate = '2026-10-12', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-12 14:37:40', entryComment = 'اضافة فاتورة مبيعات رقم 280', fromFlag = '1',related='0',isopeningentry='0',operationId='280',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=280' WHERE id = '1541';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3530.00', '3530.00', '2026-10-16', '1', '0', '1541', '2026-10-16 20:39:17','تم عكس القيد رقم 1541 ','1','0','0','0','0',''); -- id=1674
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1674', '481', '3530.00', '','0'); -- id=1678
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '-681.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1674', '143', '3530.00', '','0'); -- id=1689
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1327015.6', 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 = '3020.00', totaldebtor = '3020.00', thedate = '2026-10-12', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-12 14:37:40', entryComment = 'اضافة فاتورة مبيعات رقم 280 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='280',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=280' WHERE id = '1542';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3020.00', '3020.00', '2026-10-16', '1', '0', '1542', '2026-10-16 20:39:17','تم عكس القيد رقم 1542 ','1','0','0','0','0',''); -- id=1675
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1675', '402', '3020.00', '','0'); -- id=1679
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1187109.73', 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 ('1675', '382', '3020.00', '','0'); -- id=1690
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2321364.36', 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 ( '3530', '3530', '2026-10-16', '1', '0', '0', '2026-10-16 20:39:17','اضافة فاتورة مبيعات رقم 313','1','0',null,'0','313','sellbillController.php?do=showDetail&sellbillid=313'); -- id=1676
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1676', '481', '3530', '','0'); -- id=1691
UPDATE accountstree SET name = 'يوسف فضل', customName = 'يوسف فضل', customNameEn = 'يوسف فضل', nameEn = 'يوسف فضل', parent = '58', accountNature = '0', theValue = '2848.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:44:44' WHERE id = '481';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1676', '143', '3530', '','0'); -- id=1680
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1330545.6', 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 ( '3020', '3020', '2026-10-16', '1', '0', '0', '2026-10-16 20:39:17','اضافة فاتورة مبيعات رقم 313 - صرف البضاعة من المخزن','1','0',null,'0','313','sellbillController.php?do=showDetail&sellbillid=313'); -- id=1677
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1677', '402', '3020', '','0'); -- id=1692
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1190129.73', 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 ('1677', '382', '3020', '','0'); -- id=1681
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2318344.36', 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='1676,0,1677' where sellbillid=313;
 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-16', 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3112.5, 3112.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3530, sellCostBuyPrice =sellCostBuyPrice+3205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3112.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3112.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3112.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3112.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-10-16', 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3112.5, 3112.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3530, sellCostBuyPrice =sellCostBuyPrice+3205
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3112.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3112.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3112.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3112.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3530, 3205, 3020
                    , 3112.5, 3020, 3112.5, 3020, 3112.5, 3112.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3530, netSellCostBuyPrice = netSellCostBuyPrice+3205
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3020
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3112.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3020
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3112.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3020
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3112.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3112.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 280 and newid=313 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:09:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:39:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:39:18', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=313'); -- id=4387
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:12:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:42:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-16 20:42:27', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=4388
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:12:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:42:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-16 20:42:46', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=4389
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-16 17:12:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-16 20:42:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-16 20:42:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4390
