UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:34:16";
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-09-19 06:34:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:04:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-19 10:04:29', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1548
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-09-19',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-09-19 06:34:31";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-19 10:04:31', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1549
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:34:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:04:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1550
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:35:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:05:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:05:19', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1551

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aae421507f7a
-- ----------------------------------------------------------------------------------------------------

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-09-19 10:05:19', '06aae421507f7a', '1', '0.00', '0', '0', '1', '6459.60', '6459.6', '6459.6', '0', '1', '2026-09-19 10:05:19', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '150' ,'0','','','','','-1','0','0','0','0','0','6459','0','','0','0','6459.6','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=49
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','اضافة فاتورة مبيعات','49', '0', '2026-09-19 10:05:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6459.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 10:05:19','0','0','',''); -- id=80
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '49', '1', '4', '144', '34.9', '5025.599999999999', '0', '', '0', '2026-09-19 10:05:20', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','34.9','5025.6','0','','0','','0','0','0','0'); -- id=296
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 296;
 INSERT INTO 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-09-19', 5025.6, 5011.2, 5011.2
                    , 5011.2, 5011.2, 5011.2, 5011.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 144, 0, 5011.2, 5011.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5025.6, sellCostBuyPrice =sellCostBuyPrice+5011.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5011.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5011.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5011.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5011.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5011.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5011.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5011.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+144
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 5025.6, 5011.2, 5011.2
                    , 5011.2, 5011.2, 5011.2, 5011.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5011.2, 5011.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5025.6, sellCostBuyPrice =sellCostBuyPrice+5011.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5011.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5011.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5011.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5011.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5011.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5011.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5011.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1893', userid = '1', storedetaildate = '2026-09-19 10:05:20' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '144', '1', '49', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2037', '1893', '1', '2026-09-19 10:05:20','0','0'); -- id=865
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237','00010', '49', '1', '10', '6', '239', '1434', '0', '', '0', '2026-09-19 10:05:20', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','239','1434','0','','0','0.00','0','0','0','0'); -- id=297
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 297;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-09-19', 1434, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1434, sellCostBuyPrice =sellCostBuyPrice+1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1422
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 1434, 1422, 1422
                    , 1422, 1422, 1422, 1422
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1422, 1422, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1434, sellCostBuyPrice =sellCostBuyPrice+1422
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1422, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1422
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1422, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1422
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1422
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1422
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1422
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2026-09-19 10:05:21' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '6', '1', '49', 'اضافة فاتورة مبيعات', 'sellbillController.php', '53', '47', '1', '2026-09-19 10:05:21','0','0'); -- id=866
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-220315.525',  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 ('-226775.125','6459.6', '0', '1', 'اضافة فاتورة مبيعات', '49', '-220315.525', '2026-09-19 10:05:21', '1',  'sellbillController.php','1','','0'); -- id=51
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6459.6', '6459.6', '2026-09-19', '1', '0', '0', '2026-09-19 10:05:21','اضافة فاتورة مبيعات رقم 49','1','0',null,'0','49','sellbillController.php?do=showDetail&sellbillid=49'); -- id=581
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('581', '383', '6459.6', '','0'); -- id=581
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-173623.53', 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 ('581', '143', '6459.6', '','0'); -- id=581
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '156070.09', 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 ( '6433.2', '6433.2', '2026-09-19', '1', '0', '0', '2026-09-19 10:05:21','اضافة فاتورة مبيعات رقم 49 - صرف البضاعة من المخزن','1','0',null,'0','49','sellbillController.php?do=showDetail&sellbillid=49'); -- id=582
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('582', '402', '6433.2', '','0'); -- id=582
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '148099.36', 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 ('582', '382', '6433.2', '','0'); -- id=582
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2133138.21', 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='581,0,582' where sellbillid=49;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 6459.6, 6433.2, 6433.2
                    , 6433.2, 6433.2, 6433.2, 6433.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6433.2, 6433.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6459.6, sellCostBuyPrice =sellCostBuyPrice+6433.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6433.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6433.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6433.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6433.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6433.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6433.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6433.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-09-19', 6459.6, 6433.2, 6433.2
                    , 6433.2, 6433.2, 6433.2, 6433.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6433.2, 6433.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6459.6, sellCostBuyPrice =sellCostBuyPrice+6433.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6433.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6433.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6433.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6433.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6433.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6433.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6433.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6459.6, 6433.2, 6433.2
                    , 6433.2, 6433.2, 6433.2, 6433.2, 6433.2, 6433.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6459.6, netSellCostBuyPrice = netSellCostBuyPrice+6433.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6433.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6433.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6433.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6433.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6433.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6433.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6433.2;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aae421507f7a and sellbillId = 49 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:35:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:05:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:05:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:37:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:07:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:07:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:37:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:07:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:07:56', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:38:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:08:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:08:01', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=39'); -- id=1555
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 06:39:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:09:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:09:14', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 07:07:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:37:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:37:55', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1557

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aae432ad19bf
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(12,@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-09-19 10:37:56', '06aae432ad19bf', '12', '0.00', '1960', '0', '1', '1960.00', '1960', '0', '1960', '1', '2026-09-19 10:37:56', '', '1', '0', 'بيتر', '1', '1', '3', '0', '12 - بيتر', '50' ,'0','','','','','-1','0','0','0','0','0','1960','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=50
UPDATE client SET  clientdebt = '1960', userid = '1' WHERE clientid = '12';
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 ('12','0.00','1960','0','اضافة فاتورة مبيعات','50', '1960', '2026-09-19 10:37:56', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1960', '0', null, '0', null, null,'', '0','1','1','1960','1','2026-09-19 10:37:56','0','0','',''); -- id=81
UPDATE client SET  inUse = 0 where clientid = 12;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('53','00116', '50', '3', '116', '10', '56', '560', '0', '', '1', '2026-09-19 10:37:56', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','56','560','0','','0','0.00','0','0','0','0'); -- id=298
UPDATE sellbilldetail SET  lastbuyprice = 53.00 , meanbuyprice = 53.00, lastbuyprice_withDiscount = 53.00, meanbuyprice_withDiscount = 53.00
        , lastbuyprice_withTax = 53, meanbuyprice_withTax = 53, lastbuyprice_withDiscountAndTax = 53
                where sellbilldetailid = 298;
 INSERT INTO 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-09-19', 560, 530, 530
                    , 530, 530, 530, 530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 530, 530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 560, 530, 530
                    , 530, 530, 530, 530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 530, 530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-19 10:37:57' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '10', '1', '50', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29', '19', '1', '2026-09-19 10:37:57','0','0'); -- id=867
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '50', '3', '347', '20', '31', '620', '0', '', '1', '2026-09-19 10:37:57', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-20,','1','1','0','0','31','620','0','','0','0.00','0','0','0','0'); -- id=299
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 299;
 INSERT INTO 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-09-19', 620, 595.4, 595.4
                    , 595.4, 595.4, 595.4, 595.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 595.4, 595.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+620, sellCostBuyPrice =sellCostBuyPrice+595.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+595.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+595.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+595.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+595.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+595.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+595.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+595.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+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-09-19', 620, 595.4, 595.4
                    , 595.4, 595.4, 595.4, 595.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 595.4, 595.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+620, sellCostBuyPrice =sellCostBuyPrice+595.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+595.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+595.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+595.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+595.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+595.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+595.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+595.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 = '35', userid = '1', storedetaildate = '2026-09-19 10:37:57' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '20', '1', '50', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '35', '1', '2026-09-19 10:37:57','0','0'); -- id=868
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('37','00117', '50', '3', '117', '20', '39', '780', '0', '', '1', '2026-09-19 10:37:57', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','780','0','','0','0.00','0','0','0','0'); -- id=300
UPDATE sellbilldetail SET  lastbuyprice = 37.00 , meanbuyprice = 37.00, lastbuyprice_withDiscount = 37.00, meanbuyprice_withDiscount = 37.00
        , lastbuyprice_withTax = 37, meanbuyprice_withTax = 37, lastbuyprice_withDiscountAndTax = 37
                where sellbilldetailid = 300;
 INSERT INTO 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-09-19', 780, 740, 740
                    , 740, 740, 740, 740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 740, 740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+780, sellCostBuyPrice =sellCostBuyPrice+740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 780, 740, 740
                    , 740, 740, 740, 740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 740, 740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+780, sellCostBuyPrice =sellCostBuyPrice+740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 10:37:57' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '20', '1', '50', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '35', '1', '2026-09-19 10:37:57','0','0'); -- id=869
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1960', '1960', '2026-09-19', '1', '0', '0', '2026-09-19 10:37:58','اضافة فاتورة مبيعات رقم 50','1','0',null,'0','50','sellbillController.php?do=showDetail&sellbillid=50'); -- id=583
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('583', '439', '1960', '','0'); -- id=583
UPDATE accountstree SET name = 'بيتر', customName = 'بيتر', customNameEn = 'بيتر', nameEn = 'بيتر', parent = '58', accountNature = '0', theValue = '1960', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 09:25:00' WHERE id = '439';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('583', '143', '1960', '','0'); -- id=583
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '158030.09', 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 ( '1865.4', '1865.4', '2026-09-19', '1', '0', '0', '2026-09-19 10:37:58','اضافة فاتورة مبيعات رقم 50 - صرف البضاعة من المخزن','1','0',null,'0','50','sellbillController.php?do=showDetail&sellbillid=50'); -- id=584
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('584', '402', '1865.4', '','0'); -- id=584
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '149964.76', 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 ('584', '382', '1865.4', '','0'); -- id=584
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2131272.81', 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='583,0,584' where sellbillid=50;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 1960, 1865.4, 1865.4
                    , 1865.4, 1865.4, 1865.4, 1865.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1865.4, 1865.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1960, sellCostBuyPrice =sellCostBuyPrice+1865.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1865.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1865.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1865.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1865.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1865.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1865.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1865.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-09-19', 1960, 1865.4, 1865.4
                    , 1865.4, 1865.4, 1865.4, 1865.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1865.4, 1865.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1960, sellCostBuyPrice =sellCostBuyPrice+1865.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1865.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1865.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1865.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1865.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1865.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1865.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1865.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1960, 1865.4, 1865.4
                    , 1865.4, 1865.4, 1865.4, 1865.4, 1865.4, 1865.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1960, netSellCostBuyPrice = netSellCostBuyPrice+1865.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1865.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1865.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1865.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1865.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1865.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1865.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1865.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aae432ad19bf and sellbillId = 50 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 07:07:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 10:37:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 10:37:59', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:14:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:44:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 12:44:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:14:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:44:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 12:44:49', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:15:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:45:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 12:45:20', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1561
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كلبس 10 ملي الزفتاوي','','6','19','22','23','22','2026-09-19','0','1','0','','0','0','0','0','0','19','19','19','19','19','0','15.79','15.79','21.05','.','0','0','0','19','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','19','19','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','19','0','0','0','0','0','0','','','0','0','0','0'); -- id=405
UPDATE product SET productName = 'كلبس 10 ملي الزفتاوي', productDescription = '', productCatId = '6', productBuyPrice = '19', productSellAllPrice = '22', productSellUnitPrice = '23', productSellHalfPrice = '22', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00405',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '15.79' , buyhalf_precentage = '15.79' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '405';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '405', '1.00', '2026-09-19', '1', '0','0040501','22','22','23','19','','0','0','0','0','0','0','0','0','0','0'); -- id=405
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('405', '1', '20', '1', '2026-09-19'); -- id=405
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('405', '1', '20', '0', '405', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-09-19','0','0'); -- id=870
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (405, 1,'2026-09-19 12:45:21',1)
                ON DUPLICATE KEY UPDATE productid = 405, edited = 1, sysdate = '2026-09-19 12:45:21', userid = 1; -- id=501
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '380', '380', '2026-09-19', '1', '0', '0', '2026-09-19 12:45:22','إضافة منتج كلبس 10 ملي الزفتاوي الكمية 20','1','0','0','0','405','productController.php?do=edit&id=405'); -- id=585
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('585', '382', '380', '','0'); -- id=585
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2131652.81', 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 ('585', '121', '380', '','0'); -- id=585
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1143532.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كلبس 10 ملي الزفتاوي', productDescription = '', productCatId = '6', productBuyPrice = '19.00', productSellAllPrice = '22.00', productSellUnitPrice = '23.00', productSellHalfPrice = '22.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00405',type ='0', expireDate = '0' , dailyentryId = '585',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '15.79' , buyhalf_precentage = '15.79' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '405';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:15:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:45:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 12:45:24', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1562
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:17:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:47:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 12:47:19', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1563

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aae67a3b777f
-- ----------------------------------------------------------------------------------------------------

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-09-19 12:47:20', '06aae67a3b777f', '1', '0.00', '0', '0', '1', '184.55', '184.55', '184.55', '0', '1', '2026-09-19 12:47:20', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','184','0','','0','0','184.55','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=51
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','اضافة فاتورة مبيعات','51', '0', '2026-09-19 12:47:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '184.55', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 12:47:20','0','0','',''); -- id=82
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.5','00296', '51', '6', '296', '1', '9', '9', '0', '', '1', '2026-09-19 12:47:21', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=301
UPDATE sellbilldetail SET  lastbuyprice = 7.50 , meanbuyprice = 7.50, lastbuyprice_withDiscount = 7.50, meanbuyprice_withDiscount = 7.50
        , lastbuyprice_withTax = 7.5, meanbuyprice_withTax = 7.5, lastbuyprice_withDiscountAndTax = 7.5
                where sellbilldetailid = 301;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-09-19', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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-09-19', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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 = '72', userid = '1', storedetaildate = '2026-09-19 12:47:21' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '1', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '73', '72', '1', '2026-09-19 12:47:21','0','0'); -- id=871
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '51', '4', '368', '2', '7.5', '15', '0', '', '1', '2026-09-19 12:47:21', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','7.5','15','0','','0','0.00','0','0','0','0'); -- id=302
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 = 302;
 INSERT INTO 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-09-19', 15, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-09-19', 15, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '297', userid = '1', storedetaildate = '2026-09-19 12:47:21' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '2', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '299', '297', '1', '2026-09-19 12:47:21','0','0'); -- id=872
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '51', '4', '371', '2', '12', '24', '0', '', '1', '2026-09-19 12:47:21', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','24','0','','0','0.00','0','0','0','0'); -- id=303
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 303;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 24, 21, 20
                    , 20.5, 20, 20.5, 20
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+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-09-19', 24, 21, 20
                    , 20.5, 20, 20.5, 20
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '126', userid = '1', storedetaildate = '2026-09-19 12:47:22' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '2', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '128', '126', '1', '2026-09-19 12:47:22','0','0'); -- id=873
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '51', '4', '280', '1', '14.3', '14.3', '0', '', '1', '2026-09-19 12:47:22', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.3','14.3','0','','0','0.00','0','0','0','0'); -- id=304
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 = 304;
 INSERT INTO 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-09-19', 14.3, 13.8, 13.8
                    , 13.8, 13.8, 13.8, 13.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13.8, 13.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.3, sellCostBuyPrice =sellCostBuyPrice+13.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 14.3, 13.8, 13.8
                    , 13.8, 13.8, 13.8, 13.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13.8, 13.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.3, sellCostBuyPrice =sellCostBuyPrice+13.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.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 = '241', userid = '1', storedetaildate = '2026-09-19 12:47:22' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '1', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '242', '241', '1', '2026-09-19 12:47:22','0','0'); -- id=874
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '51', '4', '279', '1', '14.6', '14.6', '0', '', '1', '2026-09-19 12:47:22', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','14.6','0','','0','0.00','0','0','0','0'); -- id=305
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 = 305;
 INSERT INTO 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-09-19', 14.6, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.6, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-09-19', 14.6, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.6, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-09-19 12:47:22' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '1', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '179', '1', '2026-09-19 12:47:22','0','0'); -- id=875
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2.41','00313', '51', '4', '313', '3', '2.55', '7.6499999999999995', '0', '', '1', '2026-09-19 12:47:22', '313', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2.55','7.65','0','','0','0.00','0','0','0','0'); -- id=306
UPDATE sellbilldetail SET  lastbuyprice = 2.41 , meanbuyprice = 2.41, lastbuyprice_withDiscount = 2.41, meanbuyprice_withDiscount = 2.41
        , lastbuyprice_withTax = 2.41, meanbuyprice_withTax = 2.41, lastbuyprice_withDiscountAndTax = 2.41
                where sellbilldetailid = 306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (313, '2026-09-19', 7.65, 7.23, 7.23
                    , 7.23, 7.23, 7.23, 7.23
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 7.23, 7.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7.65, sellCostBuyPrice =sellCostBuyPrice+7.23
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.23, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.23, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.23
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.23
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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+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-09-19', 7.65, 7.23, 7.23
                    , 7.23, 7.23, 7.23, 7.23
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7.23, 7.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7.65, sellCostBuyPrice =sellCostBuyPrice+7.23
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.23, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.23, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.23
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.23
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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 = '612', userid = '1', storedetaildate = '2026-09-19 12:47:23' WHERE storedetailid = '313';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('313', '1', '3', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '615', '612', '1', '2026-09-19 12:47:23','0','0'); -- id=876
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('74.1','00310', '51', '4', '310', '1', '77', '77', '0', '', '1', '2026-09-19 12:47:23', '310', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','77','77','0','','0','0.00','0','0','0','0'); -- id=307
UPDATE sellbilldetail SET  lastbuyprice = 74.10 , meanbuyprice = 74.10, lastbuyprice_withDiscount = 74.10, meanbuyprice_withDiscount = 74.10
        , lastbuyprice_withTax = 74.1, meanbuyprice_withTax = 74.1, lastbuyprice_withDiscountAndTax = 74.1
                where sellbilldetailid = 307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (310, '2026-09-19', 77, 74.1, 74.1
                    , 74.1, 74.1, 74.1, 74.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 74.1, 74.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+77, sellCostBuyPrice =sellCostBuyPrice+74.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+74.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+74.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+74.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+74.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+74.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+74.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+74.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 77, 74.1, 74.1
                    , 74.1, 74.1, 74.1, 74.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 74.1, 74.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+77, sellCostBuyPrice =sellCostBuyPrice+74.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+74.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+74.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+74.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+74.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+74.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+74.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+74.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 = '15', userid = '1', storedetaildate = '2026-09-19 12:47:23' WHERE storedetailid = '310';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('310', '1', '1', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '15', '1', '2026-09-19 12:47:23','0','0'); -- id=877
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00405', '51', '6', '405', '1', '23', '23', '0', '', '1', '2026-09-19 12:47:23', '405', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=308
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (405, '2026-09-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-19 12:47:23' WHERE storedetailid = '405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('405', '1', '1', '1', '51', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '19', '1', '2026-09-19 12:47:23','0','0'); -- id=878
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-220130.98125',  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 ('-220315.53125','184.55', '0', '1', 'اضافة فاتورة مبيعات', '51', '-220130.98125', '2026-09-19 12:47:23', '1',  'sellbillController.php','1','','0'); -- id=52
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '184.55', '184.55', '2026-09-19', '1', '0', '0', '2026-09-19 12:47:24','اضافة فاتورة مبيعات رقم 51','1','0',null,'0','51','sellbillController.php?do=showDetail&sellbillid=51'); -- id=586
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('586', '383', '184.55', '','0'); -- id=586
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-173438.98', 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 ('586', '143', '184.55', '','0'); -- id=586
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '158214.64', 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 ( '169.63', '169.63', '2026-09-19', '1', '0', '0', '2026-09-19 12:47:24','اضافة فاتورة مبيعات رقم 51 - صرف البضاعة من المخزن','1','0',null,'0','51','sellbillController.php?do=showDetail&sellbillid=51'); -- id=587
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('587', '402', '169.63', '','0'); -- id=587
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '150134.39', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('587', '382', '169.63', '','0'); -- id=587
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2131483.18', 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='586,0,587' where sellbillid=51;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 184.55, 170.63, 169.63
                    , 170.13, 169.63, 170.13, 169.63
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,170.13, 170.13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+184.55, sellCostBuyPrice =sellCostBuyPrice+170.63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+169.63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+170.13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+169.63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+170.13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+169.63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+170.13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+170.13
                        , returnSellVal = returnSellVal+0, 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-09-19', 184.55, 170.63, 169.63
                    , 170.13, 169.63, 170.13, 169.63
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,170.13, 170.13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+184.55, sellCostBuyPrice =sellCostBuyPrice+170.63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+169.63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+170.13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+169.63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+170.13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+169.63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+170.13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+170.13
                        , returnSellVal = returnSellVal+0, 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, 184.55, 170.63, 169.63
                    , 170.13, 169.63, 170.13, 169.63, 170.13, 170.13)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+184.55, netSellCostBuyPrice = netSellCostBuyPrice+170.63
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+169.63
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+170.13
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+169.63
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+170.13
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+169.63
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+170.13
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+170.13;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aae67a3b777f and sellbillId = 51 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:17:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 12:47:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 12:47:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1564
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:41:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:11:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 13:11:33', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1565
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:48:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:18:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 13:18:51', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1566
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كوس 35 ملي ','','6','16','18','20','18','2026-09-19','0','1','0','','0','0','0','0','0','16','16','16','16','16','0','12.5','12.5','25','.','0','0','0','16','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','16','16','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','16','0','0','0','0','0','0','','','0','0','0','0'); -- id=406
UPDATE product SET productName = 'كوس 35 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '16', productSellAllPrice = '18', productSellUnitPrice = '20', productSellHalfPrice = '18', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00406',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '16',lastbuyprice_withDiscount = '16',meanbuyprice = '16',meanbuyprice_withDiscount = '16' , productbuypricereal = '16' , buypricereal_precentage = '0' , buytotal_precentage = '12.5' , buyhalf_precentage = '12.5' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='16',meanbuyprice_withTax='16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='16',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '406';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '406', '1.00', '2026-09-19', '1', '0','0040601','18','18','20','16','','0','0','0','0','0','0','0','0','0','0'); -- id=406
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('406', '1', '90', '1', '2026-09-19'); -- id=406
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('406', '1', '90', '0', '406', 'إضافة منتج', 'productController.php', '0', '90', '1', '2026-09-19','0','0'); -- id=879
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (406, 1,'2026-09-19 13:18:53',1)
                ON DUPLICATE KEY UPDATE productid = 406, edited = 1, sysdate = '2026-09-19 13:18:53', userid = 1; -- id=502
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1440', '1440', '2026-09-19', '1', '0', '0', '2026-09-19 13:18:53','إضافة منتج كوس 35 ملي  الكمية 90','1','0','0','0','406','productController.php?do=edit&id=406'); -- id=588
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('588', '382', '1440', '','0'); -- id=588
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2132923.18', 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 ('588', '121', '1440', '','0'); -- id=588
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1144972.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كوس 35 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '16.00', productSellAllPrice = '18.00', productSellUnitPrice = '20.00', productSellHalfPrice = '18.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00406',type ='0', expireDate = '0' , dailyentryId = '588',isService = '0',isOptic = '0',lastbuyprice = '16',lastbuyprice_withDiscount = '16',meanbuyprice = '16',meanbuyprice_withDiscount = '16' , productbuypricereal = '16' , buypricereal_precentage = '0' , buytotal_precentage = '12.5' , buyhalf_precentage = '12.5' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='16',meanbuyprice_withTax='16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='16',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '406';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كوس 25 ملي ','','6','11.25','13','15','13','2026-09-19','0','1','0','','0','0','0','0','0','11.25','11.25','11.25','11.25','11.25','0','15.56','15.56','33.33','.','0','0','0','11.25','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','11.25','11.25','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','11.25','0','0','0','0','0','0','','','0','0','0','0'); -- id=407
UPDATE product SET productName = 'كوس 25 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '11.25', productSellAllPrice = '13', productSellUnitPrice = '15', productSellHalfPrice = '13', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00407',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '11.25',lastbuyprice_withDiscount = '11.25',meanbuyprice = '11.25',meanbuyprice_withDiscount = '11.25' , productbuypricereal = '11.25' , buypricereal_precentage = '0' , buytotal_precentage = '15.56' , buyhalf_precentage = '15.56' , buypart_precentage = '33.33',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='11.25',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='11.25',meanbuyprice_withTax='11.25',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='11.25',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '407';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '407', '1.00', '2026-09-19', '1', '0','0040701','13','13','15','11.25','','0','0','0','0','0','0','0','0','0','0'); -- id=407
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('407', '1', '100', '1', '2026-09-19'); -- id=407
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('407', '1', '100', '0', '407', 'إضافة منتج', 'productController.php', '0', '100', '1', '2026-09-19','0','0'); -- id=880
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (407, 1,'2026-09-19 13:18:55',1)
                ON DUPLICATE KEY UPDATE productid = 407, edited = 1, sysdate = '2026-09-19 13:18:55', userid = 1; -- id=503
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1125', '1125', '2026-09-19', '1', '0', '0', '2026-09-19 13:18:55','إضافة منتج كوس 25 ملي  الكمية 100','1','0','0','0','407','productController.php?do=edit&id=407'); -- id=589
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('589', '382', '1125', '','0'); -- id=589
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2134048.18', 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 ('589', '121', '1125', '','0'); -- id=589
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1146097.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كوس 25 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '11.25', productSellAllPrice = '13.00', productSellUnitPrice = '15.00', productSellHalfPrice = '13.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00407',type ='0', expireDate = '0' , dailyentryId = '589',isService = '0',isOptic = '0',lastbuyprice = '11.25',lastbuyprice_withDiscount = '11.25',meanbuyprice = '11.25',meanbuyprice_withDiscount = '11.25' , productbuypricereal = '11.25' , buypricereal_precentage = '0' , buytotal_precentage = '15.56' , buyhalf_precentage = '15.56' , buypart_precentage = '33.33',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='11.25',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='11.25',meanbuyprice_withTax='11.25',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='11.25',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '407';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كوس 50 ملي ','','6','24.44','29','30','29','2026-09-19','0','1','0','','0','0','0','0','0','24.44','24.44','24.44','24.44','24.44','0','18.66','18.66','22.75','.','0','0','0','24.44','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','24.44','24.44','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','24.44','0','0','0','0','0','0','','','0','0','0','0'); -- id=408
UPDATE product SET productName = 'كوس 50 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '24.44', productSellAllPrice = '29', productSellUnitPrice = '30', productSellHalfPrice = '29', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00408',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '24.44',lastbuyprice_withDiscount = '24.44',meanbuyprice = '24.44',meanbuyprice_withDiscount = '24.44' , productbuypricereal = '24.44' , buypricereal_precentage = '0' , buytotal_precentage = '18.66' , buyhalf_precentage = '18.66' , buypart_precentage = '22.75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='24.44',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='24.44',meanbuyprice_withTax='24.44',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='24.44',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '408';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '408', '1.00', '2026-09-19', '1', '0','0040801','29','29','30','24.44','','0','0','0','0','0','0','0','0','0','0'); -- id=408
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('408', '1', '50', '1', '2026-09-19'); -- id=408
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('408', '1', '50', '0', '408', 'إضافة منتج', 'productController.php', '0', '50', '1', '2026-09-19','0','0'); -- id=881
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (408, 1,'2026-09-19 13:18:57',1)
                ON DUPLICATE KEY UPDATE productid = 408, edited = 1, sysdate = '2026-09-19 13:18:57', userid = 1; -- id=504
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1222', '1222', '2026-09-19', '1', '0', '0', '2026-09-19 13:18:57','إضافة منتج كوس 50 ملي  الكمية 50','1','0','0','0','408','productController.php?do=edit&id=408'); -- id=590
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('590', '382', '1222', '','0'); -- id=590
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2135270.18', 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 ('590', '121', '1222', '','0'); -- id=590
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1147319.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كوس 50 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '24.44', productSellAllPrice = '29.00', productSellUnitPrice = '30.00', productSellHalfPrice = '29.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00408',type ='0', expireDate = '0' , dailyentryId = '590',isService = '0',isOptic = '0',lastbuyprice = '24.44',lastbuyprice_withDiscount = '24.44',meanbuyprice = '24.44',meanbuyprice_withDiscount = '24.44' , productbuypricereal = '24.44' , buypricereal_precentage = '0' , buytotal_precentage = '18.66' , buyhalf_precentage = '18.66' , buypart_precentage = '22.75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='24.44',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='24.44',meanbuyprice_withTax='24.44',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='24.44',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '408';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كيس ترامل 2.5 ملي ','','6','21','23','30','23','2026-09-19','0','1','0','','0','0','0','0','0','21','21','21','21','21','0','9.52','9.52','42.86','.','0','0','0','21','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','21','21','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','21','0','0','0','0','0','0','','','0','0','0','0'); -- id=409
UPDATE product SET productName = 'كيس ترامل 2.5 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '21', productSellAllPrice = '23', productSellUnitPrice = '30', productSellHalfPrice = '23', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '21',lastbuyprice_withDiscount = '21',meanbuyprice = '21',meanbuyprice_withDiscount = '21' , productbuypricereal = '21' , buypricereal_precentage = '0' , buytotal_precentage = '9.52' , buyhalf_precentage = '9.52' , buypart_precentage = '42.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21',meanbuyprice_withTax='21',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '409';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '409', '1.00', '2026-09-19', '1', '0','0040901','23','23','30','21','','0','0','0','0','0','0','0','0','0','0'); -- id=409
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('409', '1', '8', '1', '2026-09-19'); -- id=409
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('409', '1', '8', '0', '409', 'إضافة منتج', 'productController.php', '0', '8', '1', '2026-09-19','0','0'); -- id=882
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (409, 1,'2026-09-19 13:18:59',1)
                ON DUPLICATE KEY UPDATE productid = 409, edited = 1, sysdate = '2026-09-19 13:18:59', userid = 1; -- id=505
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '168', '168', '2026-09-19', '1', '0', '0', '2026-09-19 13:18:59','إضافة منتج كيس ترامل 2.5 ملي  الكمية 8','1','0','0','0','409','productController.php?do=edit&id=409'); -- id=591
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('591', '382', '168', '','0'); -- id=591
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2135438.18', 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 ('591', '121', '168', '','0'); -- id=591
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1147487.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس ترامل 2.5 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '21.00', productSellAllPrice = '23.00', productSellUnitPrice = '30.00', productSellHalfPrice = '23.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00409',type ='0', expireDate = '0' , dailyentryId = '591',isService = '0',isOptic = '0',lastbuyprice = '21',lastbuyprice_withDiscount = '21',meanbuyprice = '21',meanbuyprice_withDiscount = '21' , productbuypricereal = '21' , buypricereal_precentage = '0' , buytotal_precentage = '9.52' , buyhalf_precentage = '9.52' , buypart_precentage = '42.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21',meanbuyprice_withTax='21',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '409';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كيس ترامل 4 ملي ','','6','27','29','35','29','2026-09-19','0','1','0','','0','0','0','0','0','27','27','27','27','27','0','7.41','7.41','29.63','.','0','0','0','27','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','27','27','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','27','0','0','0','0','0','0','','','0','0','0','0'); -- id=410
UPDATE product SET productName = 'كيس ترامل 4 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '27', productSellAllPrice = '29', productSellUnitPrice = '35', productSellHalfPrice = '29', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00410',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '27',lastbuyprice_withDiscount = '27',meanbuyprice = '27',meanbuyprice_withDiscount = '27' , productbuypricereal = '27' , buypricereal_precentage = '0' , buytotal_precentage = '7.41' , buyhalf_precentage = '7.41' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='27',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='27',meanbuyprice_withTax='27',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='27',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '410';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '410', '1.00', '2026-09-19', '1', '0','0041001','29','29','35','27','','0','0','0','0','0','0','0','0','0','0'); -- id=410
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('410', '1', '1', '1', '2026-09-19'); -- id=410
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('410', '1', '1', '0', '410', 'إضافة منتج', 'productController.php', '0', '1', '1', '2026-09-19','0','0'); -- id=883
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (410, 1,'2026-09-19 13:19:01',1)
                ON DUPLICATE KEY UPDATE productid = 410, edited = 1, sysdate = '2026-09-19 13:19:01', userid = 1; -- id=506
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '27', '27', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:01','إضافة منتج كيس ترامل 4 ملي  الكمية 1','1','0','0','0','410','productController.php?do=edit&id=410'); -- id=592
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('592', '382', '27', '','0'); -- id=592
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2135465.18', 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 ('592', '121', '27', '','0'); -- id=592
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1147514.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس ترامل 4 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '27.00', productSellAllPrice = '29.00', productSellUnitPrice = '35.00', productSellHalfPrice = '29.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00410',type ='0', expireDate = '0' , dailyentryId = '592',isService = '0',isOptic = '0',lastbuyprice = '27',lastbuyprice_withDiscount = '27',meanbuyprice = '27',meanbuyprice_withDiscount = '27' , productbuypricereal = '27' , buypricereal_precentage = '0' , buytotal_precentage = '7.41' , buyhalf_precentage = '7.41' , buypart_precentage = '29.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='27',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='27',meanbuyprice_withTax='27',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='27',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '410';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كيس ترامل 6 ملي ','','6','41','45','50','45','2026-09-19','0','1','0','','0','0','0','0','0','41','41','41','41','41','0','9.76','9.76','21.95','.','0','0','0','41','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','41','41','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','41','0','0','0','0','0','0','','','0','0','0','0'); -- id=411
UPDATE product SET productName = 'كيس ترامل 6 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '41', productSellAllPrice = '45', productSellUnitPrice = '50', productSellHalfPrice = '45', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00411',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '41',lastbuyprice_withDiscount = '41',meanbuyprice = '41',meanbuyprice_withDiscount = '41' , productbuypricereal = '41' , buypricereal_precentage = '0' , buytotal_precentage = '9.76' , buyhalf_precentage = '9.76' , buypart_precentage = '21.95',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='41',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='41',meanbuyprice_withTax='41',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='41',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '411';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '411', '1.00', '2026-09-19', '1', '0','0041101','45','45','50','41','','0','0','0','0','0','0','0','0','0','0'); -- id=411
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('411', '1', '9', '1', '2026-09-19'); -- id=411
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('411', '1', '9', '0', '411', 'إضافة منتج', 'productController.php', '0', '9', '1', '2026-09-19','0','0'); -- id=884
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (411, 1,'2026-09-19 13:19:03',1)
                ON DUPLICATE KEY UPDATE productid = 411, edited = 1, sysdate = '2026-09-19 13:19:03', userid = 1; -- id=507
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '369', '369', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:03','إضافة منتج كيس ترامل 6 ملي  الكمية 9','1','0','0','0','411','productController.php?do=edit&id=411'); -- id=593
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('593', '382', '369', '','0'); -- id=593
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2135834.18', 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 ('593', '121', '369', '','0'); -- id=593
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1147883.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس ترامل 6 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '41.00', productSellAllPrice = '45.00', productSellUnitPrice = '50.00', productSellHalfPrice = '45.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00411',type ='0', expireDate = '0' , dailyentryId = '593',isService = '0',isOptic = '0',lastbuyprice = '41',lastbuyprice_withDiscount = '41',meanbuyprice = '41',meanbuyprice_withDiscount = '41' , productbuypricereal = '41' , buypricereal_precentage = '0' , buytotal_precentage = '9.76' , buyhalf_precentage = '9.76' , buypart_precentage = '21.95',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='41',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='41',meanbuyprice_withTax='41',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='41',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '411';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كيس ترامل 10 ملي ','','6','50','55','60','55','2026-09-19','0','1','0','','0','0','0','0','0','50','50','50','50','50','0','10','10','20','.','0','0','0','50','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','50','50','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','50','0','0','0','0','0','0','','','0','0','0','0'); -- id=412
UPDATE product SET productName = 'كيس ترامل 10 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '50', productSellAllPrice = '55', productSellUnitPrice = '60', productSellHalfPrice = '55', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00412',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '50',lastbuyprice_withDiscount = '50',meanbuyprice = '50',meanbuyprice_withDiscount = '50' , productbuypricereal = '50' , buypricereal_precentage = '0' , buytotal_precentage = '10' , buyhalf_precentage = '10' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='50',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='50',meanbuyprice_withTax='50',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='50',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '412';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '412', '1.00', '2026-09-19', '1', '0','0041201','55','55','60','50','','0','0','0','0','0','0','0','0','0','0'); -- id=412
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('412', '1', '3', '1', '2026-09-19'); -- id=412
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('412', '1', '3', '0', '412', 'إضافة منتج', 'productController.php', '0', '3', '1', '2026-09-19','0','0'); -- id=885
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (412, 1,'2026-09-19 13:19:05',1)
                ON DUPLICATE KEY UPDATE productid = 412, edited = 1, sysdate = '2026-09-19 13:19:05', userid = 1; -- id=508
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '150', '150', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:05','إضافة منتج كيس ترامل 10 ملي  الكمية 3','1','0','0','0','412','productController.php?do=edit&id=412'); -- id=594
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('594', '382', '150', '','0'); -- id=594
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2135984.18', 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 ('594', '121', '150', '','0'); -- id=594
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1148033.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس ترامل 10 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '50.00', productSellAllPrice = '55.00', productSellUnitPrice = '60.00', productSellHalfPrice = '55.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00412',type ='0', expireDate = '0' , dailyentryId = '594',isService = '0',isOptic = '0',lastbuyprice = '50',lastbuyprice_withDiscount = '50',meanbuyprice = '50',meanbuyprice_withDiscount = '50' , productbuypricereal = '50' , buypricereal_precentage = '0' , buytotal_precentage = '10' , buyhalf_precentage = '10' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='50',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='50',meanbuyprice_withTax='50',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='50',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '412';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('علبه كلبس 6 ملي ','','6','13','15','20','15','2026-09-19','0','1','0','','0','0','0','0','0','13','13','13','13','13','0','15.38','15.38','53.85','.','0','0','0','13','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','13','13','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','13','0','0','0','0','0','0','','','0','0','0','0'); -- id=413
UPDATE product SET productName = 'علبه كلبس 6 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '13', productSellAllPrice = '15', productSellUnitPrice = '20', productSellHalfPrice = '15', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00413',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '13',lastbuyprice_withDiscount = '13',meanbuyprice = '13',meanbuyprice_withDiscount = '13' , productbuypricereal = '13' , buypricereal_precentage = '0' , buytotal_precentage = '15.38' , buyhalf_precentage = '15.38' , buypart_precentage = '53.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13',meanbuyprice_withTax='13',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '413';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '413', '1.00', '2026-09-19', '1', '0','0041301','15','15','20','13','','0','0','0','0','0','0','0','0','0','0'); -- id=413
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('413', '1', '13', '1', '2026-09-19'); -- id=413
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('413', '1', '13', '0', '413', 'إضافة منتج', 'productController.php', '0', '13', '1', '2026-09-19','0','0'); -- id=886
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (413, 1,'2026-09-19 13:19:07',1)
                ON DUPLICATE KEY UPDATE productid = 413, edited = 1, sysdate = '2026-09-19 13:19:07', userid = 1; -- id=509
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '169', '169', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:07','إضافة منتج علبه كلبس 6 ملي  الكمية 13','1','0','0','0','413','productController.php?do=edit&id=413'); -- id=595
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('595', '382', '169', '','0'); -- id=595
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2136153.18', 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 ('595', '121', '169', '','0'); -- id=595
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1148202.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'علبه كلبس 6 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '13.00', productSellAllPrice = '15.00', productSellUnitPrice = '20.00', productSellHalfPrice = '15.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00413',type ='0', expireDate = '0' , dailyentryId = '595',isService = '0',isOptic = '0',lastbuyprice = '13',lastbuyprice_withDiscount = '13',meanbuyprice = '13',meanbuyprice_withDiscount = '13' , productbuypricereal = '13' , buypricereal_precentage = '0' , buytotal_precentage = '15.38' , buyhalf_precentage = '15.38' , buypart_precentage = '53.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13',meanbuyprice_withTax='13',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '413';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('علبه كلبس 8 ملي ','','6','16','19','25','19','2026-09-19','0','1','0','','0','0','0','0','0','16','16','16','16','16','0','18.75','18.75','56.25','.','0','0','0','16','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','16','16','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','16','0','0','0','0','0','0','','','0','0','0','0'); -- id=414
UPDATE product SET productName = 'علبه كلبس 8 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '16', productSellAllPrice = '19', productSellUnitPrice = '25', productSellHalfPrice = '19', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00414',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '16',lastbuyprice_withDiscount = '16',meanbuyprice = '16',meanbuyprice_withDiscount = '16' , productbuypricereal = '16' , buypricereal_precentage = '0' , buytotal_precentage = '18.75' , buyhalf_precentage = '18.75' , buypart_precentage = '56.25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='16',meanbuyprice_withTax='16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='16',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '414';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '414', '1.00', '2026-09-19', '1', '0','0041401','19','19','25','16','','0','0','0','0','0','0','0','0','0','0'); -- id=414
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('414', '1', '18', '1', '2026-09-19'); -- id=414
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('414', '1', '18', '0', '414', 'إضافة منتج', 'productController.php', '0', '18', '1', '2026-09-19','0','0'); -- id=887
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (414, 1,'2026-09-19 13:19:09',1)
                ON DUPLICATE KEY UPDATE productid = 414, edited = 1, sysdate = '2026-09-19 13:19:09', userid = 1; -- id=510
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '288', '288', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:09','إضافة منتج علبه كلبس 8 ملي  الكمية 18','1','0','0','0','414','productController.php?do=edit&id=414'); -- id=596
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('596', '382', '288', '','0'); -- id=596
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2136441.18', 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 ('596', '121', '288', '','0'); -- id=596
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1148490.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'علبه كلبس 8 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '16.00', productSellAllPrice = '19.00', productSellUnitPrice = '25.00', productSellHalfPrice = '19.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00414',type ='0', expireDate = '0' , dailyentryId = '596',isService = '0',isOptic = '0',lastbuyprice = '16',lastbuyprice_withDiscount = '16',meanbuyprice = '16',meanbuyprice_withDiscount = '16' , productbuypricereal = '16' , buypricereal_precentage = '0' , buytotal_precentage = '18.75' , buyhalf_precentage = '18.75' , buypart_precentage = '56.25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='16',meanbuyprice_withTax='16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='16',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '414';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:49:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:19:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-19 13:19:10', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=1567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:49:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:19:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 13:19:11', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:49:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:19:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-19 13:19:52', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=1569
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-09-19' WHERE storedetailid = '405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('405', '1', '12', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '19', '7', '1', '2026-09-19','0','0'); -- id=888
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '228', '228', '2026-09-19', '1', '0', '0', '2026-09-19 13:19:53','اعادة جرد للمنتج : (كلبس 10 ملي الزفتاوي/اخري) فى مخزن : (المخزن الرئيسي) بالكمية : 7','1','0',null,'0','888','inventoryController.php?do=details&id=888'); -- id=597
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('597', '188', '228', '','0'); -- id=597
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-50578.75', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('597', '382', '228', '','0'); -- id=597
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2136213.18', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:49:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:19:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 13:19:56', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1570
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:50:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:20:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 13:20:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1571
UPDATE productunit SET proUnitSellUnitPrice = 23 * productnumber WHERE productid = 414;
UPDATE product SET productName = 'علبه كلبس 8 ملي ', productDescription = '', productCatId = '6', productBuyPrice = '16.00', productSellAllPrice = '19.00', productSellUnitPrice = '23', productSellHalfPrice = '19.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00414',type ='0', expireDate = '0' , dailyentryId = '596',isService = '0',isOptic = '0',lastbuyprice = '16.00',lastbuyprice_withDiscount = '16',meanbuyprice = '16.00',meanbuyprice_withDiscount = '16' , productbuypricereal = '16.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '18.75' , buyhalf_precentage = '18.75' , buypart_precentage = '56.25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='16',meanbuyprice_withTax='16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='16',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '414';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (414, 1,'2026-09-19 13:20:32',1)
                ON DUPLICATE KEY UPDATE productid = 414, edited = 1, sysdate = '2026-09-19 13:20:32', userid = 1; -- id=510
UPDATE productunit SET proUnitSellUnitPrice = 25 * productnumber WHERE productid = 405;
UPDATE product SET productName = 'كلبس 10 ملي الزفتاوي', productDescription = '', productCatId = '6', productBuyPrice = '19.00', productSellAllPrice = '22.00', productSellUnitPrice = '25', productSellHalfPrice = '22.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00405',type ='0', expireDate = '0' , dailyentryId = '585',isService = '0',isOptic = '0',lastbuyprice = '19.00',lastbuyprice_withDiscount = '19',meanbuyprice = '19.00',meanbuyprice_withDiscount = '19' , productbuypricereal = '19.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '15.79' , buyhalf_precentage = '15.79' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '405';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (405, 1,'2026-09-19 13:20:35',1)
                ON DUPLICATE KEY UPDATE productid = 405, edited = 1, sysdate = '2026-09-19 13:20:35', userid = 1; -- id=501
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 09:50:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 13:20:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 13:20:39', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 11:19:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 14:49:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 14:49:29', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1573
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 11:20:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 14:50:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 14:50:23', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1574
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('اتوماتيك 20 امبير بيتشينو','','6','115','115','120','120','2026-09-19','0','1','0','','0','0','0','0','0','115','115','115','115','115','0','0','4.35','4.35','.','0','0','0','115','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','115','115','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','115','0','0','0','0','0','0','','','0','0','0','0'); -- id=415
UPDATE product SET productName = 'اتوماتيك 20 امبير بيتشينو', productDescription = '', productCatId = '6', productBuyPrice = '115', productSellAllPrice = '115', productSellUnitPrice = '120', productSellHalfPrice = '120', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00415',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '115',lastbuyprice_withDiscount = '115',meanbuyprice = '115',meanbuyprice_withDiscount = '115' , productbuypricereal = '115' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.35' , buypart_precentage = '4.35',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='115',meanbuyprice_withTax='115',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='115',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '415';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '415', '1.00', '2026-09-19', '1', '0','0041501','115','120','120','115','','0','0','0','0','0','0','0','0','0','0'); -- id=415
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('415', '1', '2', '1', '2026-09-19'); -- id=415
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '2', '0', '415', 'إضافة منتج', 'productController.php', '0', '2', '1', '2026-09-19','0','0'); -- id=889
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (415, 1,'2026-09-19 14:50:25',1)
                ON DUPLICATE KEY UPDATE productid = 415, edited = 1, sysdate = '2026-09-19 14:50:25', userid = 1; -- id=513
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '230', '230', '2026-09-19', '1', '0', '0', '2026-09-19 14:50:25','إضافة منتج اتوماتيك 20 امبير بيتشينو الكمية 2','1','0','0','0','415','productController.php?do=edit&id=415'); -- id=598
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('598', '382', '230', '','0'); -- id=598
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2136443.18', 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 ('598', '121', '230', '','0'); -- id=598
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1148720.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'اتوماتيك 20 امبير بيتشينو', productDescription = '', productCatId = '6', productBuyPrice = '115.00', productSellAllPrice = '115.00', productSellUnitPrice = '120.00', productSellHalfPrice = '120.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00415',type ='0', expireDate = '0' , dailyentryId = '598',isService = '0',isOptic = '0',lastbuyprice = '115',lastbuyprice_withDiscount = '115',meanbuyprice = '115',meanbuyprice_withDiscount = '115' , productbuypricereal = '115' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.35' , buypart_precentage = '4.35',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='115',meanbuyprice_withTax='115',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='115',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '415';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كوفريه 2 خط ','','6','13','15','15','15','2026-09-19','0','1','0','','0','0','0','0','0','13','13','13','13','13','0','15.38','15.38','15.38','.','0','0','0','13','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','13','13','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','13','0','0','0','0','0','0','','','0','0','0','0'); -- id=416
UPDATE product SET productName = 'كوفريه 2 خط ', productDescription = '', productCatId = '6', productBuyPrice = '13', productSellAllPrice = '15', productSellUnitPrice = '15', productSellHalfPrice = '15', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00416',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '13',lastbuyprice_withDiscount = '13',meanbuyprice = '13',meanbuyprice_withDiscount = '13' , productbuypricereal = '13' , buypricereal_precentage = '0' , buytotal_precentage = '15.38' , buyhalf_precentage = '15.38' , buypart_precentage = '15.38',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13',meanbuyprice_withTax='13',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '416';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '416', '1.00', '2026-09-19', '1', '0','0041601','15','15','15','13','','0','0','0','0','0','0','0','0','0','0'); -- id=416
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('416', '1', '6', '1', '2026-09-19'); -- id=416
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '6', '0', '416', 'إضافة منتج', 'productController.php', '0', '6', '1', '2026-09-19','0','0'); -- id=890
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (416, 1,'2026-09-19 14:50:27',1)
                ON DUPLICATE KEY UPDATE productid = 416, edited = 1, sysdate = '2026-09-19 14:50:27', userid = 1; -- id=514
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '78', '78', '2026-09-19', '1', '0', '0', '2026-09-19 14:50:27','إضافة منتج كوفريه 2 خط  الكمية 6','1','0','0','0','416','productController.php?do=edit&id=416'); -- id=599
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('599', '382', '78', '','0'); -- id=599
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2136521.18', 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 ('599', '121', '78', '','0'); -- id=599
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1148798.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كوفريه 2 خط ', productDescription = '', productCatId = '6', productBuyPrice = '13.00', productSellAllPrice = '15.00', productSellUnitPrice = '15.00', productSellHalfPrice = '15.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00416',type ='0', expireDate = '0' , dailyentryId = '599',isService = '0',isOptic = '0',lastbuyprice = '13',lastbuyprice_withDiscount = '13',meanbuyprice = '13',meanbuyprice_withDiscount = '13' , productbuypricereal = '13' , buypricereal_precentage = '0' , buytotal_precentage = '15.38' , buyhalf_precentage = '15.38' , buypart_precentage = '15.38',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13',meanbuyprice_withTax='13',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '416';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 11:20:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 14:50:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 14:50:30', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 11:21:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 14:51:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 14:51:03', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1576
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 39;
UPDATE sellbill SET  sellbillsysdate = '2026-09-19 14:51:04', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '39';
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 223;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '45', '1', '2026-09-17 17:27:44','0','0'); -- id=891
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 224;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-09-17 17:27:44','0','0'); -- id=892
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 = 225;
 INSERT INTO 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-09-19', 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-09-19', 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 = '100', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '98', '100', '1', '2026-09-17 17:27:44','0','0'); -- id=893
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 = 226;
 INSERT INTO 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-09-19', 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-09-19', 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 = '629', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '628', '629', '1', '2026-09-17 17:27:44','0','0'); -- id=894
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 25;
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 227;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1225', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1221', '1225', '1', '2026-09-17 17:27:44','0','0'); -- id=895
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 = 228;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '179', '181', '1', '2026-09-17 17:27:44','0','0'); -- id=896
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 229;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 14:51:04' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '0', '39', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=897
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '490', userid = '1' WHERE clientid = '13';
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 ('13','4398.20','3908.20','1','تعديل فاتورة مبيعات','39', '490', '2026-09-17 17:27:44', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3908.2', '0', null, '0', null, null,'', '0','1','1','3908.2','1','2026-09-17 17:27:44','0','0','',''); -- id=83
UPDATE client SET  inUse = 0 where clientid = 13;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 3908.2, 3315.88, 3315.88
                    , 3315.88, 3315.88, 3315.88, 3315.88
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3315.88, 3315.88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3908.2, sellCostBuyPrice =sellCostBuyPrice-3315.88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3315.88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3315.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3315.88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3315.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3315.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3315.88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3315.88
                        , returnSellVal = returnSellVal-0, 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 (13, '2026-09-19', 3908.2, 3315.88, 3315.88
                    , 3315.88, 3315.88, 3315.88, 3315.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3315.88, 3315.88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3908.2, sellCostBuyPrice =sellCostBuyPrice-3315.88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3315.88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3315.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3315.88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3315.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3315.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3315.88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3315.88
                        , returnSellVal = returnSellVal-0, 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, 3908.2, 3315.88, 3315.88
                    , 3315.88, 3315.88, 3315.88, 3315.88, 3315.88, 3315.88)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3908.2, netSellCostBuyPrice = netSellCostBuyPrice-3315.88
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3315.88
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3315.88
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3315.88
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3315.88
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3315.88
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3315.88
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3315.88;

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


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

COMMIT;
BEGIN;
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-17 17:27:44', '06aac063beed8d', '13', '490.00', '17434', '0', '1', '16944', '16944', '0', '16944', '1', '2026-09-17 17:27:44', '', '1', '0', 'ابراهيم صلاح ', '1', '1', '3', '0', '13 - ابراهيم صلاح ', '38.25', '39', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-17','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=52
UPDATE client SET  clientdebt = '17434', userid = '1' WHERE clientid = '13';
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 ('13','490.00','16944','0','اضافة فاتورة مبيعات (معدله)','52', '17434', '2026-09-19 14:51:05', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '16944', '0', null, '0', null, null,'', '0','1','1','3908.2','1','2026-09-17 17:27:44','0','0','',''); -- id=84
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '52', '12', '395', '2.00', '28', '56', '0', '', '1', '2026-09-19 14:51:05', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=309
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-19 14:51:05' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '43', '1', '2026-09-19 14:51:05','0','0'); -- id=898
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '52', '10', '208', '3.00', '1210', '3630', '0', '', '1', '2026-09-19 14:51:06', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','3630','0','','0','0.00','0','0','0','0'); -- id=310
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 310;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 14:51:06' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-09-19 14:51:06','0','0'); -- id=899
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '52', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-09-19 14:51:06', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=311
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 = 311;
 INSERT INTO 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-09-19', 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-09-19', 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 = '98', userid = '1', storedetaildate = '2026-09-19 14:51:06' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '98', '1', '2026-09-19 14:51:06','0','0'); -- id=900
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '52', '14', '81', '2', '19', '38', '0', '', '1', '2026-09-19 14:51:06', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=312
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 = 312;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-09-19 14:51:07' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '629', '627', '1', '2026-09-19 14:51:07','0','0'); -- id=901
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.82','00388', '52', '20', '388', '4.00', '5.25', '21', '0', '', '1', '2026-09-19 14:51:07', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-4,','1','1','0','0','5.25','21','0','','0','0.00','0','0','0','0'); -- id=313
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1221', userid = '1', storedetaildate = '2026-09-19 14:51:07' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1225', '1221', '1', '2026-09-19 14:51:07','0','0'); -- id=902
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '52', '4', '279', '2.00', '14.6', '29.2', '0', '', '1', '2026-09-19 14:51:07', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','29.2','0','','0','0.00','0','0','0','0'); -- id=314
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 = 314;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-09-19 14:51:07' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '179', '1', '2026-09-19 14:51:07','0','0'); -- id=903
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '52', '6', '211', '1.00', '85', '85', '0', '', '1', '2026-09-19 14:51:07', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=315
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 315;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-19 14:51:08' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-09-19 14:51:08','0','0'); -- id=904
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '52', '12', '87', '1', '11.3', '11.3', '0', '', '1', '2026-09-19 14:51:08', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=316
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 = 316;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-09-19 14:51:08' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '160', '159', '1', '2026-09-19 14:51:08','0','0'); -- id=905
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 19;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6762','00390', '52', '6', '390', '1', '6950', '6950', '0', '', '1', '2026-09-19 14:51:08', '390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','19-1,','1','1','0','0','6950','6950','0','','0','0.00','0','0','0','0'); -- id=317
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 317;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 14:51:08' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 14:51:08','0','0'); -- id=906
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '52', '6', '389', '1', '2550', '2550', '0', '', '1', '2026-09-19 14:51:08', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=318
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 318;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 14:51:09' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-09-19 14:51:09','0','0'); -- id=907
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2650','00234', '52', '10', '234', '1', '3100', '3100', '0', '', '1', '2026-09-19 14:51:09', '234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3100','3100','0','','0','0.00','0','0','0','0'); -- id=319
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 319;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-19 14:51:09' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-09-19 14:51:09','0','0'); -- id=908
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '52', '14', '80', '.25', '95', '23.75', '0', '', '1', '2026-09-19 14:51:09', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=320
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 320;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '9.25', userid = '1', storedetaildate = '2026-09-19 14:51:09' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9.5', '9.25', '1', '2026-09-19 14:51:09','0','0'); -- id=909
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '52', '4', '371', '1', '12', '12', '0', '', '1', '2026-09-19 14:51:09', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=321
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 321;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '125', userid = '1', storedetaildate = '2026-09-19 14:51:10' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '125', '1', '2026-09-19 14:51:10','0','0'); -- id=910
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '52', '3', '347', '4', '31', '124', '0', '', '1', '2026-09-19 14:51:10', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-4,','1','1','0','0','31','124','0','','0','0.00','0','0','0','0'); -- id=322
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 322;
 INSERT INTO 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-09-19', 124, 119.08, 119.08
                    , 119.08, 119.08, 119.08, 119.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 119.08, 119.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+124, sellCostBuyPrice =sellCostBuyPrice+119.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+119.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+119.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+119.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+119.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+119.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+119.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+119.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
                        , 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-09-19', 124, 119.08, 119.08
                    , 119.08, 119.08, 119.08, 119.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 119.08, 119.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+124, sellCostBuyPrice =sellCostBuyPrice+119.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+119.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+119.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+119.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+119.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+119.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+119.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+119.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;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-09-19 14:51:10' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '4', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '31', '1', '2026-09-19 14:51:10','0','0'); -- id=911
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '52', '3', '102', '3', '12', '36', '0', '', '1', '2026-09-19 14:51:10', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-3,','1','1','0','0','12','36','0','','0','0.00','0','0','0','0'); -- id=323
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 323;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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+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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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 = '1349', userid = '1', storedetaildate = '2026-09-19 14:51:10' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1352', '1349', '1', '2026-09-19 14:51:10','0','0'); -- id=912
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '52', '3', '120', '3', '15.75', '47.25', '0', '', '1', '2026-09-19 14:51:11', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-3,','1','1','0','0','15.75','47.25','0','','0','0.00','0','0','0','0'); -- id=324
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-09-19 14:51:11' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-09-19 14:51:11','0','0'); -- id=913
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '52', '3', '103', '5', '5.5', '27.5', '0', '', '1', '2026-09-19 14:51:11', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-5,','1','1','0','0','5.5','27.5','0','','0','0.00','0','0','0','0'); -- id=325
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 325;
 INSERT INTO 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-09-19', 27.5, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 27.5, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2066', userid = '1', storedetaildate = '2026-09-19 14:51:11' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '5', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2071', '2066', '1', '2026-09-19 14:51:11','0','0'); -- id=914
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00415', '52', '6', '415', '1', '120', '120', '0', '', '1', '2026-09-19 14:51:11', '415', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=326
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 14:51:11' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 14:51:12','0','0'); -- id=915
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00416', '52', '6', '416', '1', '15', '15', '0', '', '1', '2026-09-19 14:51:12', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=327
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-19 14:51:12' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '1', '52', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-09-19 14:51:12','0','0'); -- id=916
UPDATE dailyentry SET totalcreditor = '3908.20', totaldebtor = '3908.20', thedate = '2026-09-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-17 17:27:48', entryComment = 'اضافة فاتورة مبيعات رقم 39', fromFlag = '1',related='0',isopeningentry='0',operationId='39',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=39' WHERE id = '534';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3908.20', '3908.20', '2026-09-19', '1', '0', '534', '2026-09-19 14:51:12','تم عكس القيد رقم 534 ','1','0','0','0','0',''); -- id=600
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('600', '441', '3908.20', '','0'); -- id=600
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('600', '143', '3908.20', '','0'); -- id=600
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '154306.44', 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 = '3315.88', totaldebtor = '3315.88', thedate = '2026-09-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-17 17:27:48', entryComment = 'اضافة فاتورة مبيعات رقم 39 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='39',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=39' WHERE id = '535';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3315.88', '3315.88', '2026-09-19', '1', '0', '535', '2026-09-19 14:51:13','تم عكس القيد رقم 535 ','1','0','0','0','0',''); -- id=601
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('601', '402', '3315.88', '','0'); -- id=601
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '146818.51', 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 ('601', '382', '3315.88', '','0'); -- id=601
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2139837.06', 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 ( '16944', '16944', '2026-09-19', '1', '0', '0', '2026-09-19 14:51:13','اضافة فاتورة مبيعات رقم 52','1','0',null,'0','52','sellbillController.php?do=showDetail&sellbillid=52'); -- id=602
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('602', '441', '16944', '','0'); -- id=602
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '17434', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('602', '143', '16944', '','0'); -- id=602
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '171250.44', 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 ( '15487.31', '15487.31', '2026-09-19', '1', '0', '0', '2026-09-19 14:51:13','اضافة فاتورة مبيعات رقم 52 - صرف البضاعة من المخزن','1','0',null,'0','52','sellbillController.php?do=showDetail&sellbillid=52'); -- id=603
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('603', '402', '15487.31', '','0'); -- id=603
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '162305.82', 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 ('603', '382', '15487.31', '','0'); -- id=603
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2124349.75', 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='602,0,603' where sellbillid=52;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15487.56, 15487.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16944, sellCostBuyPrice =sellCostBuyPrice+15487.81
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15487.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15487.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15487.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15487.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15487.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15487.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15487.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-09-19', 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15487.56, 15487.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16944, sellCostBuyPrice =sellCostBuyPrice+15487.81
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15487.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15487.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15487.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15487.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15487.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15487.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15487.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31, 15487.56, 15487.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+16944, netSellCostBuyPrice = netSellCostBuyPrice+15487.81
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15487.31
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15487.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15487.31
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15487.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15487.31
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15487.56
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15487.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 39 and newid=52 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 11:21:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 14:51:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 14:51:14', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=52'); -- id=1577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:02:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 16:32:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 16:32:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1578
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:03:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 16:33:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 16:33:49', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1579

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aae9cf762e15
-- ----------------------------------------------------------------------------------------------------

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-09-19 16:33:50', '06aae9cf762e15', '1', '0.00', '0', '0', '1', '2970.00', '2970', '2970', '0', '1', '2026-09-19 16:33:50', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '39' ,'0','','','','','-1','0','0','0','0','0','2970','0','','0','0','2970','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=53
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','اضافة فاتورة مبيعات','53', '0', '2026-09-19 16:33:51', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2970', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 16:33:50','0','0','',''); -- id=85
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00160', '53', '22', '160', '4', '140', '560', '0', '', '1', '2026-09-19 16:33:51', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','140','560','0','','0','0.00','0','0','0','0'); -- id=328
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-09-19', 560, 480, 480
                    , 480, 480, 480, 480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 480, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 560, 480, 480
                    , 480, 480, 480, 480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 480, 480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 16:33:51' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '4', '1', '53', 'اضافة فاتورة مبيعات', 'sellbillController.php', '62', '58', '1', '2026-09-19 16:33:51','0','0'); -- id=917
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00002', '53', '10', '2', '25', '88', '2200', '0', '', '1', '2026-09-19 16:33:51', '2', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','88','2200','0','','0','0.00','0','0','0','0'); -- id=329
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.00, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.00
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 329;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-09-19', 2200, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2200, 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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2200, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2200, 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 = '125', userid = '1', storedetaildate = '2026-09-19 16:33:51' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '25', '1', '53', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '125', '1', '2026-09-19 16:33:51','0','0'); -- id=918
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('24.44','00408', '53', '6', '408', '4', '30', '120', '0', '', '1', '2026-09-19 16:33:51', '408', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30','120','0','','0','0.00','0','0','0','0'); -- id=330
UPDATE sellbilldetail SET  lastbuyprice = 24.44 , meanbuyprice = 24.44, lastbuyprice_withDiscount = 24.44, meanbuyprice_withDiscount = 24.44
        , lastbuyprice_withTax = 24.44, meanbuyprice_withTax = 24.44, lastbuyprice_withDiscountAndTax = 24.44
                where sellbilldetailid = 330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (408, '2026-09-19', 120, 97.76, 97.76
                    , 97.76, 97.76, 97.76, 97.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 97.76, 97.76, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.76
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.76, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.76
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.76, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.76
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.76
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.76
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 120, 97.76, 97.76
                    , 97.76, 97.76, 97.76, 97.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.76, 97.76, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.76
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.76, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.76
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.76, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.76
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.76
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.76
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-09-19 16:33:52' WHERE storedetailid = '408';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('408', '1', '4', '1', '53', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '46', '1', '2026-09-19 16:33:52','0','0'); -- id=919
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.25','00407', '53', '6', '407', '3', '15', '45', '0', '', '1', '2026-09-19 16:33:52', '407', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=331
UPDATE sellbilldetail SET  lastbuyprice = 11.25 , meanbuyprice = 11.25, lastbuyprice_withDiscount = 11.25, meanbuyprice_withDiscount = 11.25
        , lastbuyprice_withTax = 11.25, meanbuyprice_withTax = 11.25, lastbuyprice_withDiscountAndTax = 11.25
                where sellbilldetailid = 331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (407, '2026-09-19', 45, 33.75, 33.75
                    , 33.75, 33.75, 33.75, 33.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 33.75, 33.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+33.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+33.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 33.75, 33.75
                    , 33.75, 33.75, 33.75, 33.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 33.75, 33.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+33.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+33.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '1', storedetaildate = '2026-09-19 16:33:52' WHERE storedetailid = '407';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('407', '1', '3', '1', '53', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '97', '1', '2026-09-19 16:33:52','0','0'); -- id=920
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('12','00344', '53', '6', '344', '3', '15', '45', '0', '', '1', '2026-09-19 16:33:52', '344', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=332
UPDATE sellbilldetail SET  lastbuyprice = 12.00 , meanbuyprice = 12.00, lastbuyprice_withDiscount = 12.00, meanbuyprice_withDiscount = 12.00
        , lastbuyprice_withTax = 12, meanbuyprice_withTax = 12, lastbuyprice_withDiscountAndTax = 12
                where sellbilldetailid = 332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (344, '2026-09-19', 45, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-09-19 16:33:52' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '3', '1', '53', 'اضافة فاتورة مبيعات', 'sellbillController.php', '11', '8', '1', '2026-09-19 16:33:52','0','0'); -- id=921
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-217160.984375',  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 ('-220130.984375','2970', '0', '1', 'اضافة فاتورة مبيعات', '53', '-217160.984375', '2026-09-19 16:33:53', '1',  'sellbillController.php','1','','0'); -- id=53
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2970', '2970', '2026-09-19', '1', '0', '0', '2026-09-19 16:33:53','اضافة فاتورة مبيعات رقم 53','1','0',null,'0','53','sellbillController.php?do=showDetail&sellbillid=53'); -- id=604
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('604', '383', '2970', '','0'); -- id=604
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-170468.98', 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 ('604', '143', '2970', '','0'); -- id=604
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '174220.44', 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 ( '2647.51', '2647.51', '2026-09-19', '1', '0', '0', '2026-09-19 16:33:53','اضافة فاتورة مبيعات رقم 53 - صرف البضاعة من المخزن','1','0',null,'0','53','sellbillController.php?do=showDetail&sellbillid=53'); -- id=605
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('605', '402', '2647.51', '','0'); -- id=605
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '164953.33', 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 ('605', '382', '2647.51', '','0'); -- id=605
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121702.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='604,0,605' where sellbillid=53;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 2970, 2647.51, 2647.51
                    , 2647.51, 2647.51, 2647.51, 2647.51
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2647.51, 2647.51, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2647.51
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2647.51, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2647.51
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2647.51, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2647.51
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2647.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2647.51
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2647.51
                        , returnSellVal = returnSellVal+0, 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-09-19', 2970, 2647.51, 2647.51
                    , 2647.51, 2647.51, 2647.51, 2647.51
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2647.51, 2647.51, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2647.51
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2647.51, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2647.51
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2647.51, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2647.51
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2647.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2647.51
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2647.51
                        , returnSellVal = returnSellVal+0, 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, 2970, 2647.51, 2647.51
                    , 2647.51, 2647.51, 2647.51, 2647.51, 2647.51, 2647.51)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2970, netSellCostBuyPrice = netSellCostBuyPrice+2647.51
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2647.51
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2647.51
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2647.51
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2647.51
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2647.51
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2647.51
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2647.51;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aae9cf762e15 and sellbillId = 53 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:03:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 16:33:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 16:33:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:31:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:01:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-09-19 17:01:51', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellBillReportsController.php'); -- id=1581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:32:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:02:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:02:28', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=50'); -- id=1582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:32:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:02:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-09-19 17:02:49', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellBillReportsController.php'); -- id=1583
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:32:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:02:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-09-19 17:02:57', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellBillReportsController.php?do=show'); -- id=1584
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:33:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:03:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-09-19 17:03:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellBillReportsController.php?do=show'); -- id=1585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:33:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:03:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:03:19', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=52'); -- id=1586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:33:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:03:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:03:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:50:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:20:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:20:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1588
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:50:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:20:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:20:17', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:50:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:20:22', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=52'); -- id=1590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:50:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:20:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:20:49', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1591
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 52;
UPDATE sellbill SET  sellbillsysdate = '2026-09-19 17:20:50', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '52';
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '45', '1', '2026-09-17 17:27:44','0','0'); -- id=922
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 310;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-09-17 17:27:44','0','0'); -- id=923
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 = 311;
 INSERT INTO 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-09-19', 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-09-19', 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 = '100', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '98', '100', '1', '2026-09-17 17:27:44','0','0'); -- id=924
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 = 312;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '629', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '627', '629', '1', '2026-09-17 17:27:44','0','0'); -- id=925
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 25;
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1225', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1221', '1225', '1', '2026-09-17 17:27:44','0','0'); -- id=926
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 = 314;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-09-19 17:20:50' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '179', '181', '1', '2026-09-17 17:27:44','0','0'); -- id=927
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 315;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=928
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 = 316;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '160', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '159', '160', '1', '2026-09-17 17:27:44','0','0'); -- id=929
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 19;
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 317;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=930
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 18;
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 318;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-09-17 17:27:44','0','0'); -- id=931
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 319;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-17 17:27:44','0','0'); -- id=932
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 320;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.25,0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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-0.25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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 = '9.5', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9.25', '9.5', '1', '2026-09-17 17:27:44','0','0'); -- id=933
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 321;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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 = '126', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '126', '1', '2026-09-17 17:27:44','0','0'); -- id=934
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 21;
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 322;
 INSERT INTO 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-09-19', 124, 119.08, 119.08
                    , 119.08, 119.08, 119.08, 119.08
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 119.08, 119.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-124, sellCostBuyPrice =sellCostBuyPrice-119.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-119.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice-119.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-119.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-119.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-119.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-119.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-119.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
                        , 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-09-19', 124, 119.08, 119.08
                    , 119.08, 119.08, 119.08, 119.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 119.08, 119.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-124, sellCostBuyPrice =sellCostBuyPrice-119.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-119.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice-119.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-119.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-119.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-119.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-119.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-119.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;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '4', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '31', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=935
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 11;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 323;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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-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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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 = '1352', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1349', '1352', '1', '2026-09-17 17:27:44','0','0'); -- id=936
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 10;
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 324;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-09-19 17:20:51' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-09-17 17:27:44','0','0'); -- id=937
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 325;
 INSERT INTO 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-09-19', 27.5, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27.5, sellCostBuyPrice =sellCostBuyPrice-22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 27.5, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27.5, sellCostBuyPrice =sellCostBuyPrice-22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2071', userid = '1', storedetaildate = '2026-09-19 17:20:52' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '5', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2066', '2071', '1', '2026-09-17 17:27:44','0','0'); -- id=938
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 326;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 17:20:52' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=939
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-19 17:20:52' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '0', '52', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-09-17 17:27:44','0','0'); -- id=940
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '490', userid = '1' WHERE clientid = '13';
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 ('13','17434.00','16944.00','1','تعديل فاتورة مبيعات','52', '490', '2026-09-17 17:27:44', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '16944', '0', null, '0', null, null,'', '0','1','1','16944','1','2026-09-17 17:27:44','0','0','',''); -- id=86
UPDATE client SET  inUse = 0 where clientid = 13;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15487.56, 15487.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16944, sellCostBuyPrice =sellCostBuyPrice-15487.81
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15487.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15487.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15487.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15487.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15487.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15487.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15487.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-09-19', 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15487.56, 15487.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16944, sellCostBuyPrice =sellCostBuyPrice-15487.81
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15487.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15487.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15487.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15487.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15487.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15487.56
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15487.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 16944, 15487.81, 15487.31
                    , 15487.56, 15487.31, 15487.56, 15487.31, 15487.56, 15487.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-16944, netSellCostBuyPrice = netSellCostBuyPrice-15487.81
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-15487.31
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-15487.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-15487.31
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-15487.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-15487.31
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-15487.56
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-15487.56;

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


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

COMMIT;
BEGIN;
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-17 17:27:44', '06aac063beed8d', '13', '490.00', '17408.5', '0', '1', '16918.5', '16918.5', '0', '16918.5', '1', '2026-09-17 17:27:44', '', '1', '0', 'ابراهيم صلاح ', '1', '1', '3', '0', '13 - ابراهيم صلاح ', '38.25', '52', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-17','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=54
UPDATE client SET  clientdebt = '17408.5', userid = '1' WHERE clientid = '13';
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 ('13','490.00','16918.5','0','اضافة فاتورة مبيعات (معدله)','54', '17408.5', '2026-09-19 17:20:53', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '16918.5', '0', null, '0', null, null,'', '0','1','1','16944','1','2026-09-17 17:27:44','0','0','',''); -- id=87
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '54', '12', '395', '2.00', '28', '56', '0', '', '1', '2026-09-19 17:20:53', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=333
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-19 17:20:53' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '43', '1', '2026-09-19 17:20:53','0','0'); -- id=941
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '54', '10', '208', '3.00', '1210', '3630', '0', '', '1', '2026-09-19 17:20:53', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','3630','0','','0','0.00','0','0','0','0'); -- id=334
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 334;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 17:20:54' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-09-19 17:20:54','0','0'); -- id=942
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '54', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-09-19 17:20:54', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=335
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 = 335;
 INSERT INTO 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-09-19', 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-09-19', 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 = '98', userid = '1', storedetaildate = '2026-09-19 17:20:54' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '98', '1', '2026-09-19 17:20:54','0','0'); -- id=943
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '54', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-09-19 17:20:54', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=336
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 = 336;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-09-19 17:20:54' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '629', '627', '1', '2026-09-19 17:20:54','0','0'); -- id=944
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.82','00388', '54', '20', '388', '4.00', '5.25', '21', '0', '', '1', '2026-09-19 17:20:54', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-4,','1','1','0','0','5.25','21','0','','0','0.00','0','0','0','0'); -- id=337
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1221', userid = '1', storedetaildate = '2026-09-19 17:20:55' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1225', '1221', '1', '2026-09-19 17:20:55','0','0'); -- id=945
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '54', '4', '279', '2.00', '14.6', '29.2', '0', '', '1', '2026-09-19 17:20:55', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','29.2','0','','0','0.00','0','0','0','0'); -- id=338
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 = 338;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-09-19 17:20:55' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '179', '1', '2026-09-19 17:20:55','0','0'); -- id=946
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '54', '6', '211', '1.00', '85', '85', '0', '', '1', '2026-09-19 17:20:55', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=339
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-19 17:20:55' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-09-19 17:20:55','0','0'); -- id=947
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '54', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-09-19 17:20:55', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=340
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 = 340;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-09-19 17:20:56' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '160', '159', '1', '2026-09-19 17:20:56','0','0'); -- id=948
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 19;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6762','00390', '54', '6', '390', '1.00', '6950', '6950', '0', '', '1', '2026-09-19 17:20:56', '390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','19-1,','1','1','0','0','6950','6950','0','','0','0.00','0','0','0','0'); -- id=341
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 17:20:56' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 17:20:56','0','0'); -- id=949
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '54', '6', '389', '1.00', '2550', '2550', '0', '', '1', '2026-09-19 17:20:56', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=342
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 17:20:56' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-09-19 17:20:56','0','0'); -- id=950
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2650','00234', '54', '10', '234', '1.00', '3100', '3100', '0', '', '1', '2026-09-19 17:20:57', '234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3100','3100','0','','0','0.00','0','0','0','0'); -- id=343
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 343;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-19 17:20:57' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-09-19 17:20:57','0','0'); -- id=951
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '54', '14', '80', '0.25', '95', '23.75', '0', '', '1', '2026-09-19 17:20:57', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=344
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 344;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '9.25', userid = '1', storedetaildate = '2026-09-19 17:20:57' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9.5', '9.25', '1', '2026-09-19 17:20:57','0','0'); -- id=952
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '54', '4', '371', '1.00', '12', '12', '0', '', '1', '2026-09-19 17:20:57', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=345
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 345;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '125', userid = '1', storedetaildate = '2026-09-19 17:20:58' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '125', '1', '2026-09-19 17:20:58','0','0'); -- id=953
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '54', '3', '347', '3', '31', '93', '0', '', '1', '2026-09-19 17:20:58', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-3,','1','1','0','0','31','93','0','','0','0.00','0','0','0','0'); -- id=346
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 346;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-19 17:20:58' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '32', '1', '2026-09-19 17:20:58','0','0'); -- id=954
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '54', '3', '102', '3.00', '12', '36', '0', '', '1', '2026-09-19 17:20:58', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-3,','1','1','0','0','12','36','0','','0','0.00','0','0','0','0'); -- id=347
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 347;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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+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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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 = '1349', userid = '1', storedetaildate = '2026-09-19 17:20:58' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1352', '1349', '1', '2026-09-19 17:20:58','0','0'); -- id=955
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '54', '3', '120', '3.00', '15.75', '47.25', '0', '', '1', '2026-09-19 17:20:58', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-3,','1','1','0','0','15.75','47.25','0','','0','0.00','0','0','0','0'); -- id=348
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-09-19 17:20:59' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-09-19 17:20:59','0','0'); -- id=956
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '54', '3', '103', '6', '5.5', '33', '0', '', '1', '2026-09-19 17:20:59', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-6,','1','1','0','0','5.5','33','0','','0','0.00','0','0','0','0'); -- id=349
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 349;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2065', userid = '1', storedetaildate = '2026-09-19 17:20:59' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2071', '2065', '1', '2026-09-19 17:20:59','0','0'); -- id=957
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00415', '54', '6', '415', '1.00', '120', '120', '0', '', '1', '2026-09-19 17:20:59', '415', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=350
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 350;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 17:20:59' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 17:20:59','0','0'); -- id=958
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00416', '54', '6', '416', '1.00', '15', '15', '0', '', '1', '2026-09-19 17:20:59', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=351
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 351;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-19 17:21:00' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '1', '54', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-09-19 17:21:00','0','0'); -- id=959
UPDATE dailyentry SET totalcreditor = '16944.00', totaldebtor = '16944.00', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 14:51:13', entryComment = 'اضافة فاتورة مبيعات رقم 52', fromFlag = '1',related='0',isopeningentry='0',operationId='52',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=52' WHERE id = '602';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16944.00', '16944.00', '2026-09-19', '1', '0', '602', '2026-09-19 17:21:00','تم عكس القيد رقم 602 ','1','0','0','0','0',''); -- id=606
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('606', '441', '16944.00', '','0'); -- id=606
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('606', '143', '16944.00', '','0'); -- id=606
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '157276.44', 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 = '15487.31', totaldebtor = '15487.31', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 14:51:13', entryComment = 'اضافة فاتورة مبيعات رقم 52 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='52',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=52' WHERE id = '603';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15487.31', '15487.31', '2026-09-19', '1', '0', '603', '2026-09-19 17:21:00','تم عكس القيد رقم 603 ','1','0','0','0','0',''); -- id=607
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('607', '402', '15487.31', '','0'); -- id=607
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '149466.02', 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 ('607', '382', '15487.31', '','0'); -- id=607
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2137189.55', 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 ( '16918.5', '16918.5', '2026-09-19', '1', '0', '0', '2026-09-19 17:21:01','اضافة فاتورة مبيعات رقم 54','1','0',null,'0','54','sellbillController.php?do=showDetail&sellbillid=54'); -- id=608
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('608', '441', '16918.5', '','0'); -- id=608
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '17408.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('608', '143', '16918.5', '','0'); -- id=608
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '174194.94', 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 ( '15462.04', '15462.04', '2026-09-19', '1', '0', '0', '2026-09-19 17:21:01','اضافة فاتورة مبيعات رقم 54 - صرف البضاعة من المخزن','1','0',null,'0','54','sellbillController.php?do=showDetail&sellbillid=54'); -- id=609
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('609', '402', '15462.04', '','0'); -- id=609
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '164928.06', 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 ('609', '382', '15462.04', '','0'); -- id=609
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121727.51', 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='608,0,609' where sellbillid=54;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15462.29, 15462.29, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16918.5, sellCostBuyPrice =sellCostBuyPrice+15462.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15462.04, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15462.29
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15462.04, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15462.29
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15462.04
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15462.29
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15462.29
                        , returnSellVal = returnSellVal+0, 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 (13, '2026-09-19', 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15462.29, 15462.29, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16918.5, sellCostBuyPrice =sellCostBuyPrice+15462.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15462.04, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15462.29
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15462.04, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15462.29
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15462.04
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15462.29
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15462.29
                        , returnSellVal = returnSellVal+0, 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, 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04, 15462.29, 15462.29)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+16918.5, netSellCostBuyPrice = netSellCostBuyPrice+15462.54
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15462.04
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15462.29
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15462.04
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15462.29
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15462.04
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15462.29
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15462.29;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 52 and newid=54 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 13:51:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 17:21:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 17:21:02', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=54'); -- id=1592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:38:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:08:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:08:32', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1593
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:38:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:08:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:08:43', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1594
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:39:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:09:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:39:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:09:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:09:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1596
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:41:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:12:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:12:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:42:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:12:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:12:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:42:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:12:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:12:51', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1599
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:43:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:13:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:13:30', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1600
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('متر سلك 3 ملي الفؤاد','','10','21','23','23.5','23','2026-09-19','0','1','0','','0','0','0','0','0','21','21','21','21','21','0','9.52','9.52','11.9','.','0','0','0','21','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','21','21','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','21','0','0','0','0','0','0','','','0','0','0','0'); -- id=417
UPDATE product SET productName = 'متر سلك 3 ملي الفؤاد', productDescription = '', productCatId = '10', productBuyPrice = '21', productSellAllPrice = '23', productSellUnitPrice = '23.5', productSellHalfPrice = '23', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00417',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '21',lastbuyprice_withDiscount = '21',meanbuyprice = '21',meanbuyprice_withDiscount = '21' , productbuypricereal = '21' , buypricereal_precentage = '0' , buytotal_precentage = '9.52' , buyhalf_precentage = '9.52' , buypart_precentage = '11.9',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21',meanbuyprice_withTax='21',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '417';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '417', '1.00', '2026-09-19', '1', '0','0041701','23','23','23.5','21','','0','0','0','0','0','0','0','0','0','0'); -- id=417
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('417', '1', '100', '1', '2026-09-19'); -- id=417
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '100', '0', '417', 'إضافة منتج', 'productController.php', '0', '100', '1', '2026-09-19','0','0'); -- id=960
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (417, 1,'2026-09-19 18:13:31',1)
                ON DUPLICATE KEY UPDATE productid = 417, edited = 1, sysdate = '2026-09-19 18:13:31', userid = 1; -- id=515
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2100', '2100', '2026-09-19', '1', '0', '0', '2026-09-19 18:13:31','إضافة منتج متر سلك 3 ملي الفؤاد الكمية 100','1','0','0','0','417','productController.php?do=edit&id=417'); -- id=610
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('610', '382', '2100', '','0'); -- id=610
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2123827.51', 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 ('610', '121', '2100', '','0'); -- id=610
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1150898.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'متر سلك 3 ملي الفؤاد', productDescription = '', productCatId = '10', productBuyPrice = '21.00', productSellAllPrice = '23.00', productSellUnitPrice = '23.50', productSellHalfPrice = '23.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00417',type ='0', expireDate = '0' , dailyentryId = '610',isService = '0',isOptic = '0',lastbuyprice = '21',lastbuyprice_withDiscount = '21',meanbuyprice = '21',meanbuyprice_withDiscount = '21' , productbuypricereal = '21' , buypricereal_precentage = '0' , buytotal_precentage = '9.52' , buyhalf_precentage = '9.52' , buypart_precentage = '11.9',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='21',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21',meanbuyprice_withTax='21',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '417';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:43:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:13:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:13:34', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1601
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:44:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:14:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:14:22', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1602

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaeb467629a8
-- ----------------------------------------------------------------------------------------------------

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-09-19 18:14:23', '06aaeb467629a8', '1', '0.00', '0', '0', '1', '2250.00', '2250', '2250', '0', '1', '2026-09-19 18:14:23', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','2250','0','','0','0','2250','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=55
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','اضافة فاتورة مبيعات','55', '0', '2026-09-19 18:14:23', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2250', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 18:14:23','0','0','',''); -- id=88
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2000','00251', '55', '10', '251', '1', '2250', '2250', '0', '', '1', '2026-09-19 18:14:24', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2250','2250','0','','0','0.00','0','0','0','0'); -- id=352
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2000.00, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2000.00
        , lastbuyprice_withTax = 2000, meanbuyprice_withTax = 2000, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 352;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-09-19', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-09-19 18:14:24' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '55', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '48', '1', '2026-09-19 18:14:24','0','0'); -- id=961
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-214910.984375',  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 ('-217160.984375','2250', '0', '1', 'اضافة فاتورة مبيعات', '55', '-214910.984375', '2026-09-19 18:14:24', '1',  'sellbillController.php','1','','0'); -- id=54
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2250', '2250', '2026-09-19', '1', '0', '0', '2026-09-19 18:14:24','اضافة فاتورة مبيعات رقم 55','1','0',null,'0','55','sellbillController.php?do=showDetail&sellbillid=55'); -- id=611
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('611', '383', '2250', '','0'); -- id=611
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-168218.98', 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 ('611', '143', '2250', '','0'); -- id=611
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '176444.94', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2000', '2000', '2026-09-19', '1', '0', '0', '2026-09-19 18:14:24','اضافة فاتورة مبيعات رقم 55 - صرف البضاعة من المخزن','1','0',null,'0','55','sellbillController.php?do=showDetail&sellbillid=55'); -- id=612
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('612', '402', '2000', '','0'); -- id=612
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '166928.06', 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 ('612', '382', '2000', '','0'); -- id=612
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121827.51', 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='611,0,612' where sellbillid=55;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2250, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2250, 2000, 2000
                    , 2000, 2000, 2000, 2000, 2000, 2000)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2250, netSellCostBuyPrice = netSellCostBuyPrice+2000
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2000
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2000
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2000
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2000
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2000
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2000
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2000;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaeb467629a8 and sellbillId = 55 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:44:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:14:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:14:25', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1603
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:44:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:14:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:14:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:46:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:16:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:16:30', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1605

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaeb4f4a6b5f
-- ----------------------------------------------------------------------------------------------------

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-09-19 18:16:31', '06aaeb4f4a6b5f', '1', '0.00', '0', '0', '1', '3788.00', '3788', '3788', '0', '1', '2026-09-19 18:16:31', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '62' ,'0','','','','','-1','0','0','0','0','0','3788','0','','0','0','3788','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=56
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','اضافة فاتورة مبيعات','56', '0', '2026-09-19 18:16:31', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3788', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 18:16:31','0','0','',''); -- id=89
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21','00417', '56', '10', '417', '40', '23.5', '940', '0', '', '1', '2026-09-19 18:16:31', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23.5','940','0','','0','0.00','0','0','0','0'); -- id=353
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 = 353;
 INSERT INTO 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-09-19', 940, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 940, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-09-19 18:16:32' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '40', '1', '56', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '60', '1', '2026-09-19 18:16:32','0','0'); -- id=962
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('65','00255', '56', '10', '255', '1', '73', '73', '0', '', '1', '2026-09-19 18:16:32', '255', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','73','73','0','','0','0.00','0','0','0','0'); -- id=354
UPDATE sellbilldetail SET  lastbuyprice = 65.00 , meanbuyprice = 65.00, lastbuyprice_withDiscount = 65.00, meanbuyprice_withDiscount = 65.00
        , lastbuyprice_withTax = 65, meanbuyprice_withTax = 65, lastbuyprice_withDiscountAndTax = 65
                where sellbilldetailid = 354;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (255, '2026-09-19', 73, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+73, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 73, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+73, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-19 18:16:32' WHERE storedetailid = '255';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('255', '1', '1', '1', '56', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '79', '1', '2026-09-19 18:16:32','0','0'); -- id=963
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00377', '56', '6', '377', '1', '50', '50', '0', '', '1', '2026-09-19 18:16:32', '377', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','50','50','0','','0','0.00','0','0','0','0'); -- id=355
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 355;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (377, '2026-09-19', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2026-09-19 18:16:33' WHERE storedetailid = '377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('377', '1', '1', '1', '56', 'اضافة فاتورة مبيعات', 'sellbillController.php', '38', '37', '1', '2026-09-19 18:16:33','0','0'); -- id=964
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215.25','00143', '56', '21', '143', '5', '218', '1090', '0', '', '1', '2026-09-19 18:16:33', '143', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','218','1090','0','','0','0.00','0','0','0','0'); -- id=356
UPDATE sellbilldetail SET  lastbuyprice = 215.25 , meanbuyprice = 215.25, lastbuyprice_withDiscount = 215.25, meanbuyprice_withDiscount = 215.25
        , lastbuyprice_withTax = 215.25, meanbuyprice_withTax = 215.25, lastbuyprice_withDiscountAndTax = 215.25
                where sellbilldetailid = 356;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (143, '2026-09-19', 1090, 1076.25, 1076.25
                    , 1076.25, 1076.25, 1076.25, 1076.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1076.25, 1076.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1090, sellCostBuyPrice =sellCostBuyPrice+1076.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1076.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1076.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1076.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1076.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1076.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1076.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1076.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+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 1090, 1076.25, 1076.25
                    , 1076.25, 1076.25, 1076.25, 1076.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1076.25, 1076.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1090, sellCostBuyPrice =sellCostBuyPrice+1076.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1076.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1076.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1076.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1076.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1076.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1076.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1076.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 = '9', userid = '1', storedetaildate = '2026-09-19 18:16:33' WHERE storedetailid = '143';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('143', '1', '5', '1', '56', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '9', '1', '2026-09-19 18:16:33','0','0'); -- id=965
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00006', '56', '1', '6', '15', '109', '1635', '0', '', '1', '2026-09-19 18:16:33', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','109','1635','0','','0','0.00','0','0','0','0'); -- id=357
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 357;
 INSERT INTO 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-09-19', 1635, 1575, 1575
                    , 1575, 1575, 1575, 1575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1575, 1575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 1635, 1575, 1575
                    , 1575, 1575, 1575, 1575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1575, 1575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '157', userid = '1', storedetaildate = '2026-09-19 18:16:33' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '15', '1', '56', 'اضافة فاتورة مبيعات', 'sellbillController.php', '172', '157', '1', '2026-09-19 18:16:33','0','0'); -- id=966
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-211122.984375',  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 ('-214910.984375','3788', '0', '1', 'اضافة فاتورة مبيعات', '56', '-211122.984375', '2026-09-19 18:16:33', '1',  'sellbillController.php','1','','0'); -- id=55
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3788', '3788', '2026-09-19', '1', '0', '0', '2026-09-19 18:16:34','اضافة فاتورة مبيعات رقم 56','1','0',null,'0','56','sellbillController.php?do=showDetail&sellbillid=56'); -- id=613
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('613', '383', '3788', '','0'); -- id=613
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-164430.98', 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 ('613', '143', '3788', '','0'); -- id=613
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '180232.94', 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 ( '3601.25', '3601.25', '2026-09-19', '1', '0', '0', '2026-09-19 18:16:34','اضافة فاتورة مبيعات رقم 56 - صرف البضاعة من المخزن','1','0',null,'0','56','sellbillController.php?do=showDetail&sellbillid=56'); -- id=614
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('614', '402', '3601.25', '','0'); -- id=614
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '170529.31', 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 ('614', '382', '3601.25', '','0'); -- id=614
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2118226.26', 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='613,0,614' where sellbillid=56;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 3788, 3601.25, 3601.25
                    , 3601.25, 3601.25, 3601.25, 3601.25
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3601.25, 3601.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3788, sellCostBuyPrice =sellCostBuyPrice+3601.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3601.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3601.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3601.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3601.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3601.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3601.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3601.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;
 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-09-19', 3788, 3601.25, 3601.25
                    , 3601.25, 3601.25, 3601.25, 3601.25
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3601.25, 3601.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3788, sellCostBuyPrice =sellCostBuyPrice+3601.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3601.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3601.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3601.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3601.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3601.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3601.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3601.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3788, 3601.25, 3601.25
                    , 3601.25, 3601.25, 3601.25, 3601.25, 3601.25, 3601.25)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3788, netSellCostBuyPrice = netSellCostBuyPrice+3601.25
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3601.25
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3601.25
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3601.25
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3601.25
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3601.25
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3601.25
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3601.25;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaeb4f4a6b5f and sellbillId = 56 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 14:46:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:16:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:16:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1606
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:03:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:33:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:33:53', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:04:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:34:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:34:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:04:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:34:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:34:09', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=54'); -- id=1609
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:04:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:34:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:34:33', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1610
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 54;
UPDATE sellbill SET  sellbillsysdate = '2026-09-19 18:34:34', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '54';
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '45', '1', '2026-09-17 17:27:44','0','0'); -- id=967
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 334;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-09-17 17:27:44','0','0'); -- id=968
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 = 335;
 INSERT INTO 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-09-19', 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-09-19', 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 = '100', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '98', '100', '1', '2026-09-17 17:27:44','0','0'); -- id=969
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 = 336;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '629', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '627', '629', '1', '2026-09-17 17:27:44','0','0'); -- id=970
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 25;
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1225', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1221', '1225', '1', '2026-09-17 17:27:44','0','0'); -- id=971
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 = 338;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '179', '181', '1', '2026-09-17 17:27:44','0','0'); -- id=972
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=973
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 = 340;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '160', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '159', '160', '1', '2026-09-17 17:27:44','0','0'); -- id=974
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 19;
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 18:34:34' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=975
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 18;
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-09-17 17:27:44','0','0'); -- id=976
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 343;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-17 17:27:44','0','0'); -- id=977
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 344;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.25,0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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-0.25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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 = '9.5', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9.25', '9.5', '1', '2026-09-17 17:27:44','0','0'); -- id=978
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 345;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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 = '126', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '126', '1', '2026-09-17 17:27:44','0','0'); -- id=979
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 21;
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 346;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=980
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 11;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 347;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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-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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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 = '1352', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1349', '1352', '1', '2026-09-17 17:27:44','0','0'); -- id=981
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 10;
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-09-17 17:27:44','0','0'); -- id=982
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 349;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2071', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2065', '2071', '1', '2026-09-17 17:27:44','0','0'); -- id=983
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 350;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=984
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 351;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-19 18:34:35' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '0', '54', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-09-17 17:27:44','0','0'); -- id=985
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '490', userid = '1' WHERE clientid = '13';
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 ('13','17408.50','16918.50','1','تعديل فاتورة مبيعات','54', '490', '2026-09-17 17:27:44', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '16918.5', '0', null, '0', null, null,'', '0','1','1','16918.5','1','2026-09-17 17:27:44','0','0','',''); -- id=90
UPDATE client SET  inUse = 0 where clientid = 13;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15462.29, 15462.29, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16918.5, sellCostBuyPrice =sellCostBuyPrice-15462.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15462.04, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15462.29
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15462.04, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15462.29
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15462.04
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15462.29
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15462.29
                        , returnSellVal = returnSellVal-0, 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 (13, '2026-09-19', 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15462.29, 15462.29, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16918.5, sellCostBuyPrice =sellCostBuyPrice-15462.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15462.04, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15462.29
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15462.04, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15462.29
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15462.04
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15462.29
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15462.29
                        , returnSellVal = returnSellVal-0, 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, 16918.5, 15462.54, 15462.04
                    , 15462.29, 15462.04, 15462.29, 15462.04, 15462.29, 15462.29)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-16918.5, netSellCostBuyPrice = netSellCostBuyPrice-15462.54
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-15462.04
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-15462.29
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-15462.04
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-15462.29
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-15462.04
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-15462.29
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-15462.29;

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


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

COMMIT;
BEGIN;
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-17 17:27:44', '06aac063beed8d', '13', '490.00', '17453.5', '0', '1', '16963.5', '16963.5', '0', '16963.5', '1', '2026-09-17 17:27:44', '', '1', '0', 'ابراهيم صلاح ', '1', '1', '3', '0', '13 - ابراهيم صلاح ', '39.25', '54', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-17','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=57
UPDATE client SET  clientdebt = '17453.5', userid = '1' WHERE clientid = '13';
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 ('13','490.00','16963.5','0','اضافة فاتورة مبيعات (معدله)','57', '17453.5', '2026-09-19 18:34:36', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '16963.5', '0', null, '0', null, null,'', '0','1','1','16918.5','1','2026-09-17 17:27:44','0','0','',''); -- id=91
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '57', '12', '395', '2.00', '28', '56', '0', '', '1', '2026-09-19 18:34:36', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=358
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-19 18:34:37' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '43', '1', '2026-09-19 18:34:37','0','0'); -- id=986
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '57', '10', '208', '3.00', '1210', '3630', '0', '', '1', '2026-09-19 18:34:37', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','3630','0','','0','0.00','0','0','0','0'); -- id=359
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 359;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 18:34:37' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-09-19 18:34:37','0','0'); -- id=987
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '57', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-09-19 18:34:37', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=360
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 = 360;
 INSERT INTO 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-09-19', 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-09-19', 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 = '98', userid = '1', storedetaildate = '2026-09-19 18:34:37' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '98', '1', '2026-09-19 18:34:37','0','0'); -- id=988
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '57', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-09-19 18:34:37', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=361
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 = 361;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-09-19 18:34:38' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '629', '627', '1', '2026-09-19 18:34:38','0','0'); -- id=989
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.82','00388', '57', '20', '388', '4.00', '5.25', '21', '0', '', '1', '2026-09-19 18:34:38', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-4,','1','1','0','0','5.25','21','0','','0','0.00','0','0','0','0'); -- id=362
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1221', userid = '1', storedetaildate = '2026-09-19 18:34:38' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1225', '1221', '1', '2026-09-19 18:34:38','0','0'); -- id=990
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '57', '4', '279', '2.00', '14.6', '29.2', '0', '', '1', '2026-09-19 18:34:38', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','29.2','0','','0','0.00','0','0','0','0'); -- id=363
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 = 363;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29.2, sellCostBuyPrice =sellCostBuyPrice+28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '179', userid = '1', storedetaildate = '2026-09-19 18:34:38' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '179', '1', '2026-09-19 18:34:39','0','0'); -- id=991
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '57', '6', '211', '1.00', '85', '85', '0', '', '1', '2026-09-19 18:34:39', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=364
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 364;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-19 18:34:39' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-09-19 18:34:39','0','0'); -- id=992
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '57', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-09-19 18:34:39', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=365
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 = 365;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-09-19 18:34:39' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '160', '159', '1', '2026-09-19 18:34:39','0','0'); -- id=993
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 19;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6762','00390', '57', '6', '390', '1.00', '6950', '6950', '0', '', '1', '2026-09-19 18:34:39', '390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','19-1,','1','1','0','0','6950','6950','0','','0','0.00','0','0','0','0'); -- id=366
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 18:34:40' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 18:34:40','0','0'); -- id=994
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '57', '6', '389', '1.00', '2550', '2550', '0', '', '1', '2026-09-19 18:34:40', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=367
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 18:34:40' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-09-19 18:34:40','0','0'); -- id=995
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2650','00234', '57', '10', '234', '1.00', '3100', '3100', '0', '', '1', '2026-09-19 18:34:40', '234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3100','3100','0','','0','0.00','0','0','0','0'); -- id=368
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-19 18:34:40' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-09-19 18:34:40','0','0'); -- id=996
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '57', '14', '80', '0.25', '95', '23.75', '0', '', '1', '2026-09-19 18:34:40', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=369
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '9.25', userid = '1', storedetaildate = '2026-09-19 18:34:41' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9.5', '9.25', '1', '2026-09-19 18:34:41','0','0'); -- id=997
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '57', '4', '371', '1.00', '12', '12', '0', '', '1', '2026-09-19 18:34:41', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=370
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 370;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '125', userid = '1', storedetaildate = '2026-09-19 18:34:41' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '125', '1', '2026-09-19 18:34:41','0','0'); -- id=998
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '57', '3', '347', '3.00', '31', '93', '0', '', '1', '2026-09-19 18:34:41', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-3,','1','1','0','0','31','93','0','','0','0.00','0','0','0','0'); -- id=371
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 371;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-19 18:34:41' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '32', '1', '2026-09-19 18:34:41','0','0'); -- id=999
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '57', '3', '102', '3.00', '12', '36', '0', '', '1', '2026-09-19 18:34:41', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-3,','1','1','0','0','12','36','0','','0','0.00','0','0','0','0'); -- id=372
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 372;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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+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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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 = '1349', userid = '1', storedetaildate = '2026-09-19 18:34:42' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1352', '1349', '1', '2026-09-19 18:34:42','0','0'); -- id=1000
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '57', '3', '120', '3.00', '15.75', '47.25', '0', '', '1', '2026-09-19 18:34:42', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-3,','1','1','0','0','15.75','47.25','0','','0','0.00','0','0','0','0'); -- id=373
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 373;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-09-19 18:34:42' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-09-19 18:34:42','0','0'); -- id=1001
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '57', '3', '103', '6.00', '5.5', '33', '0', '', '1', '2026-09-19 18:34:42', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-6,','1','1','0','0','5.5','33','0','','0','0.00','0','0','0','0'); -- id=374
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 374;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2065', userid = '1', storedetaildate = '2026-09-19 18:34:42' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2071', '2065', '1', '2026-09-19 18:34:42','0','0'); -- id=1002
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00415', '57', '6', '415', '1.00', '120', '120', '0', '', '1', '2026-09-19 18:34:42', '415', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=375
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 375;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 18:34:43' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 18:34:43','0','0'); -- id=1003
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00416', '57', '6', '416', '1.00', '15', '15', '0', '', '1', '2026-09-19 18:34:43', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=376
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-19 18:34:43' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-09-19 18:34:43','0','0'); -- id=1004
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.3','00083', '57', '12', '83', '1', '45', '45', '0', '', '1', '2026-09-19 18:34:43', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=377
UPDATE sellbilldetail SET  lastbuyprice = 42.30 , meanbuyprice = 42.30, lastbuyprice_withDiscount = 42.30, meanbuyprice_withDiscount = 42.30
        , lastbuyprice_withTax = 42.3, meanbuyprice_withTax = 42.3, lastbuyprice_withDiscountAndTax = 42.3
                where sellbilldetailid = 377;
 INSERT INTO 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-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '139', userid = '1', storedetaildate = '2026-09-19 18:34:43' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '57', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '140', '139', '1', '2026-09-19 18:34:43','0','0'); -- id=1005
UPDATE dailyentry SET totalcreditor = '16918.50', totaldebtor = '16918.50', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 17:21:01', entryComment = 'اضافة فاتورة مبيعات رقم 54', fromFlag = '1',related='0',isopeningentry='0',operationId='54',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=54' WHERE id = '608';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16918.50', '16918.50', '2026-09-19', '1', '0', '608', '2026-09-19 18:34:44','تم عكس القيد رقم 608 ','1','0','0','0','0',''); -- id=615
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('615', '441', '16918.50', '','0'); -- id=615
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('615', '143', '16918.50', '','0'); -- id=615
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '163314.44', 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 = '15462.04', totaldebtor = '15462.04', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 17:21:01', entryComment = 'اضافة فاتورة مبيعات رقم 54 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='54',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=54' WHERE id = '609';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15462.04', '15462.04', '2026-09-19', '1', '0', '609', '2026-09-19 18:34:44','تم عكس القيد رقم 609 ','1','0','0','0','0',''); -- id=616
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('616', '402', '15462.04', '','0'); -- id=616
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '155067.27', 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 ('616', '382', '15462.04', '','0'); -- id=616
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2133688.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16963.5', '16963.5', '2026-09-19', '1', '0', '0', '2026-09-19 18:34:44','اضافة فاتورة مبيعات رقم 57','1','0',null,'0','57','sellbillController.php?do=showDetail&sellbillid=57'); -- id=617
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('617', '441', '16963.5', '','0'); -- id=617
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '17453.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('617', '143', '16963.5', '','0'); -- id=617
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '180277.94', 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 ( '15504.34', '15504.34', '2026-09-19', '1', '0', '0', '2026-09-19 18:34:44','اضافة فاتورة مبيعات رقم 57 - صرف البضاعة من المخزن','1','0',null,'0','57','sellbillController.php?do=showDetail&sellbillid=57'); -- id=618
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('618', '402', '15504.34', '','0'); -- id=618
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '170571.61', 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 ('618', '382', '15504.34', '','0'); -- id=618
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2118183.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='617,0,618' where sellbillid=57;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15504.59, 15504.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16963.5, sellCostBuyPrice =sellCostBuyPrice+15504.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15504.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15504.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15504.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15504.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15504.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15504.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15504.59
                        , returnSellVal = returnSellVal+0, 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 (13, '2026-09-19', 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15504.59, 15504.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16963.5, sellCostBuyPrice =sellCostBuyPrice+15504.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15504.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15504.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15504.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15504.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15504.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15504.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15504.59
                        , returnSellVal = returnSellVal+0, 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, 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34, 15504.59, 15504.59)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+16963.5, netSellCostBuyPrice = netSellCostBuyPrice+15504.84
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15504.34
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15504.59
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15504.34
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15504.59
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15504.34
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15504.59
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15504.59;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 54 and newid=57 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:04:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:34:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:34:46', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=57'); -- id=1611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:23:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:53:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:53:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:23:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:53:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:53:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:23:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:53:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:53:24', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=57'); -- id=1614
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:26:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:56:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 18:56:15', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:27:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 18:57:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 18:57:32', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:30:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 19:00:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 19:00:12', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1617
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('سوسته عود ماجنتيك بعد الجبس ','','8','19','29','39','29','2026-09-19','0','1','0','','0','0','0','0','0','19','19','19','19','19','0','52.63','52.63','105.26','.','0','0','0','19','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','19','19','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','19','0','0','0','0','0','0','','','0','0','0','0'); -- id=418
UPDATE product SET productName = 'سوسته عود ماجنتيك بعد الجبس ', productDescription = '', productCatId = '8', productBuyPrice = '19', productSellAllPrice = '29', productSellUnitPrice = '39', productSellHalfPrice = '29', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00418',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '52.63' , buyhalf_precentage = '52.63' , buypart_precentage = '105.26',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '418';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '418', '1.00', '2026-09-19', '1', '0','0041801','29','29','39','19','','0','0','0','0','0','0','0','0','0','0'); -- id=418
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('418', '1', '59', '1', '2026-09-19'); -- id=418
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('418', '1', '59', '0', '418', 'إضافة منتج', 'productController.php', '0', '59', '1', '2026-09-19','0','0'); -- id=1006
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (418, 1,'2026-09-19 19:00:13',1)
                ON DUPLICATE KEY UPDATE productid = 418, edited = 1, sysdate = '2026-09-19 19:00:13', userid = 1; -- id=516
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1121', '1121', '2026-09-19', '1', '0', '0', '2026-09-19 19:00:13','إضافة منتج سوسته عود ماجنتيك بعد الجبس  الكمية 59','1','0','0','0','418','productController.php?do=edit&id=418'); -- id=619
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('619', '382', '1121', '','0'); -- id=619
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2119304.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';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('619', '121', '1121', '','0'); -- id=619
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1152019.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'سوسته عود ماجنتيك بعد الجبس ', productDescription = '', productCatId = '8', productBuyPrice = '19.00', productSellAllPrice = '29.00', productSellUnitPrice = '39.00', productSellHalfPrice = '29.00', productDate = '2026-09-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00418',type ='0', expireDate = '0' , dailyentryId = '619',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '52.63' , buyhalf_precentage = '52.63' , buypart_precentage = '105.26',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '418';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:30:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 19:00:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-19 19:00:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:40:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 19:10:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 19:10:52', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1619

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaebeb013c01
-- ----------------------------------------------------------------------------------------------------

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-09-19 19:10:52', '06aaebeb013c01', '1', '0.00', '0', '0', '1', '3009.00', '3009', '3009', '0', '1', '2026-09-19 19:10:52', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '23' ,'0','','','','','-1','0','0','0','0','0','3009','0','','0','0','3009','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=58
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','اضافة فاتورة مبيعات','58', '0', '2026-09-19 19:10:53', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3009', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 19:10:52','0','0','',''); -- 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 ('562','00027', '58', '8', '27', '2', '690', '1380', '0', '', '1', '2026-09-19 19:10:53', '27', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','690','1380','0','','0','0.00','0','0','0','0'); -- id=378
UPDATE sellbilldetail SET  lastbuyprice = 562.00 , meanbuyprice = 562.00, lastbuyprice_withDiscount = 562.00, meanbuyprice_withDiscount = 562.00
        , lastbuyprice_withTax = 562, meanbuyprice_withTax = 562, lastbuyprice_withDiscountAndTax = 562
                where sellbilldetailid = 378;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (27, '2026-09-19', 1380, 1124, 1124
                    , 1124, 1124, 1124, 1124
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1124, 1124, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1124
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1124, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1124
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1124, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1124
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1124
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1124
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1124
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 1380, 1124, 1124
                    , 1124, 1124, 1124, 1124
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1124, 1124, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1124
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1124, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1124
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1124, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1124
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1124
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1124
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1124
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2026-09-19 19:10:53' WHERE storedetailid = '27';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('27', '1', '2', '1', '58', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '23', '1', '2026-09-19 19:10:53','0','0'); -- id=1007
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00418', '58', '8', '418', '6', '39', '234', '0', '', '1', '2026-09-19 19:10:53', '418', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','234','0','','0','0.00','0','0','0','0'); -- id=379
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 379;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (418, '2026-09-19', 234, 114, 114
                    , 114, 114, 114, 114
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 114, 114, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+234, sellCostBuyPrice =sellCostBuyPrice+114
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+114, sellCostMeanBuyPrice = sellCostMeanBuyPrice+114
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+114, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+114
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+114
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+114
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+114
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 234, 114, 114
                    , 114, 114, 114, 114
                    , 0, 0, 0, 0
                    , 0, 0, 0, 114, 114, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+234, sellCostBuyPrice =sellCostBuyPrice+114
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+114, sellCostMeanBuyPrice = sellCostMeanBuyPrice+114
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+114, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+114
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+114
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+114
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+114
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-09-19 19:10:54' WHERE storedetailid = '418';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('418', '1', '6', '1', '58', 'اضافة فاتورة مبيعات', 'sellbillController.php', '59', '53', '1', '2026-09-19 19:10:54','0','0'); -- id=1008
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 16;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00387', '58', '7', '387', '15', '93', '1395', '0', '', '1', '2026-09-19 19:10:54', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','16-15,','1','1','0','0','93','1395','0','','0','0.00','0','0','0','0'); -- id=380
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 380;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (387, '2026-09-19', 1395, 1200, 1200
                    , 1208.7, 1200, 1208.7, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1200, 1208.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1208.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1208.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1208.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+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 1395, 1200, 1200
                    , 1208.7, 1200, 1208.7, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1208.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1208.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1208.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1208.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 = '47', userid = '1', storedetaildate = '2026-09-19 19:10:54' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '15', '1', '58', 'اضافة فاتورة مبيعات', 'sellbillController.php', '62', '47', '1', '2026-09-19 19:10:54','0','0'); -- id=1009
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-208113.984375',  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 ('-211122.984375','3009', '0', '1', 'اضافة فاتورة مبيعات', '58', '-208113.984375', '2026-09-19 19:10:54', '1',  'sellbillController.php','1','','0'); -- id=56
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3009', '3009', '2026-09-19', '1', '0', '0', '2026-09-19 19:10:54','اضافة فاتورة مبيعات رقم 58','1','0',null,'0','58','sellbillController.php?do=showDetail&sellbillid=58'); -- id=620
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('620', '383', '3009', '','0'); -- id=620
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-161421.98', 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 ('620', '143', '3009', '','0'); -- id=620
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '183286.94', 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 ( '2438', '2438', '2026-09-19', '1', '0', '0', '2026-09-19 19:10:54','اضافة فاتورة مبيعات رقم 58 - صرف البضاعة من المخزن','1','0',null,'0','58','sellbillController.php?do=showDetail&sellbillid=58'); -- id=621
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('621', '402', '2438', '','0'); -- id=621
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '173009.61', 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 ('621', '382', '2438', '','0'); -- id=621
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2116866.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='620,0,621' where sellbillid=58;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 3009, 2438, 2438
                    , 2446.7, 2438, 2446.7, 2438
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2438, 2446.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3009, sellCostBuyPrice =sellCostBuyPrice+2438
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2438, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2446.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2438, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2446.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2438
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2438
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2446.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;
 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-09-19', 3009, 2438, 2438
                    , 2446.7, 2438, 2446.7, 2438
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2438, 2446.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3009, sellCostBuyPrice =sellCostBuyPrice+2438
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2438, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2446.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2438, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2446.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2438
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2438
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2446.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3009, 2438, 2438
                    , 2446.7, 2438, 2446.7, 2438, 2438, 2446.7)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3009, netSellCostBuyPrice = netSellCostBuyPrice+2438
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2438
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2446.7
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2438
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2446.7
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2438
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2438
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2446.7;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaebeb013c01 and sellbillId = 58 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 15:40:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 19:10:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 19:10:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1620
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 16:30:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 20:00:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 20:00:04', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1621
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 16:30:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 20:00:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 20:00:12', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 16:30:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 20:00:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 20:00:17', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=57'); -- id=1623
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 16:30:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 20:00:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 20:00:34', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1624
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 57;
UPDATE sellbill SET  sellbillsysdate = '2026-09-19 20:00:35', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '57';
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '45', '1', '2026-09-17 17:27:44','0','0'); -- id=1010
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 359;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-09-17 17:27:44','0','0'); -- id=1011
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 = 360;
 INSERT INTO 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-09-19', 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-09-19', 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 = '100', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '98', '100', '1', '2026-09-17 17:27:44','0','0'); -- id=1012
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 = 361;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '629', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '627', '629', '1', '2026-09-17 17:27:44','0','0'); -- id=1013
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 25;
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1225', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1221', '1225', '1', '2026-09-17 17:27:44','0','0'); -- id=1014
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 = 363;
 INSERT INTO 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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 29.2, 28, 28
                    , 28, 28, 28, 28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-29.2, sellCostBuyPrice =sellCostBuyPrice-28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '2', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '179', '181', '1', '2026-09-17 17:27:44','0','0'); -- id=1015
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 364;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=1016
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 = 365;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '160', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '159', '160', '1', '2026-09-17 17:27:44','0','0'); -- id=1017
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 19;
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 366;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=1018
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 18;
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 367;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-09-17 17:27:44','0','0'); -- id=1019
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 368;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-17 17:27:44','0','0'); -- id=1020
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 369;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.25,0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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-0.25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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 = '9.5', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9.25', '9.5', '1', '2026-09-17 17:27:44','0','0'); -- id=1021
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 370;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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 = '126', userid = '1', storedetaildate = '2026-09-19 20:00:35' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '126', '1', '2026-09-17 17:27:44','0','0'); -- id=1022
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 21;
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 371;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=1023
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 11;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 372;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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-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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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 = '1352', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1349', '1352', '1', '2026-09-17 17:27:44','0','0'); -- id=1024
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 10;
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 373;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-09-17 17:27:44','0','0'); -- id=1025
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 374;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2071', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2065', '2071', '1', '2026-09-17 17:27:44','0','0'); -- id=1026
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 375;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=1027
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-09-17 17:27:44','0','0'); -- id=1028
UPDATE sellbilldetail SET  lastbuyprice = 42.30 , meanbuyprice = 42.30, lastbuyprice_withDiscount = 42.30, meanbuyprice_withDiscount = 42.30
        , lastbuyprice_withTax = 42.3, meanbuyprice_withTax = 42.3, lastbuyprice_withDiscountAndTax = 42.3
                where sellbilldetailid = 377;
 INSERT INTO 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-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '140', userid = '1', storedetaildate = '2026-09-19 20:00:36' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '0', '57', 'تعديل فاتورة مبيعات', 'sellbillController.php', '139', '140', '1', '2026-09-17 17:27:44','0','0'); -- id=1029
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '490', userid = '1' WHERE clientid = '13';
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 ('13','17453.50','16963.50','1','تعديل فاتورة مبيعات','57', '490', '2026-09-17 17:27:44', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '16963.5', '0', null, '0', null, null,'', '0','1','1','16963.5','1','2026-09-17 17:27:44','0','0','',''); -- id=93
UPDATE client SET  inUse = 0 where clientid = 13;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15504.59, 15504.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16963.5, sellCostBuyPrice =sellCostBuyPrice-15504.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15504.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15504.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15504.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15504.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15504.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15504.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15504.59
                        , returnSellVal = returnSellVal-0, 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 (13, '2026-09-19', 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15504.59, 15504.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16963.5, sellCostBuyPrice =sellCostBuyPrice-15504.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15504.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15504.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15504.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15504.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15504.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15504.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15504.59
                        , returnSellVal = returnSellVal-0, 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, 16963.5, 15504.84, 15504.34
                    , 15504.59, 15504.34, 15504.59, 15504.34, 15504.59, 15504.59)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-16963.5, netSellCostBuyPrice = netSellCostBuyPrice-15504.84
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-15504.34
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-15504.59
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-15504.34
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-15504.59
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-15504.34
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-15504.59
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-15504.59;

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


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

COMMIT;
BEGIN;
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-17 17:27:44', '06aac063beed8d', '13', '490.00', '17468.1', '0', '1', '16978.1', '16978.1', '0', '16978.1', '1', '2026-09-17 17:27:44', '', '1', '0', 'ابراهيم صلاح ', '1', '1', '3', '0', '13 - ابراهيم صلاح ', '40.25', '57', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-17','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=59
UPDATE client SET  clientdebt = '17468.1', userid = '1' WHERE clientid = '13';
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 ('13','490.00','16978.1','0','اضافة فاتورة مبيعات (معدله)','59', '17468.1', '2026-09-19 20:00:37', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '16978.1', '0', null, '0', null, null,'', '0','1','1','16963.5','1','2026-09-17 17:27:44','0','0','',''); -- id=94
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '59', '12', '395', '2.00', '28', '56', '0', '', '1', '2026-09-19 20:00:37', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=381
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 381;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-19 20:00:38' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '43', '1', '2026-09-19 20:00:38','0','0'); -- id=1030
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '59', '10', '208', '3.00', '1210', '3630', '0', '', '1', '2026-09-19 20:00:38', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','3630','0','','0','0.00','0','0','0','0'); -- id=382
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 382;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 20:00:38' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-09-19 20:00:38','0','0'); -- id=1031
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '59', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-09-19 20:00:38', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=383
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 = 383;
 INSERT INTO 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-09-19', 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-09-19', 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 = '98', userid = '1', storedetaildate = '2026-09-19 20:00:38' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '98', '1', '2026-09-19 20:00:38','0','0'); -- id=1032
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '59', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-09-19 20:00:38', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=384
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 = 384;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-09-19 20:00:39' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '629', '627', '1', '2026-09-19 20:00:39','0','0'); -- id=1033
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.82','00388', '59', '20', '388', '4.00', '5.25', '21', '0', '', '1', '2026-09-19 20:00:39', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-4,','1','1','0','0','5.25','21','0','','0','0.00','0','0','0','0'); -- id=385
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 385;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1221', userid = '1', storedetaildate = '2026-09-19 20:00:39' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1225', '1221', '1', '2026-09-19 20:00:39','0','0'); -- id=1034
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '59', '4', '279', '3', '14.6', '43.8', '0', '', '1', '2026-09-19 20:00:39', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','43.8','0','','0','0.00','0','0','0','0'); -- id=386
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 = 386;
 INSERT INTO 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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+43.8, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+43.8, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '178', userid = '1', storedetaildate = '2026-09-19 20:00:39' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '3', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '178', '1', '2026-09-19 20:00:39','0','0'); -- id=1035
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '59', '6', '211', '1.00', '85', '85', '0', '', '1', '2026-09-19 20:00:40', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=387
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 387;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-19 20:00:40' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-09-19 20:00:40','0','0'); -- id=1036
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '59', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-09-19 20:00:40', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=388
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 = 388;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-09-19 20:00:40' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '160', '159', '1', '2026-09-19 20:00:40','0','0'); -- id=1037
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 19;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6762','00390', '59', '6', '390', '1.00', '6950', '6950', '0', '', '1', '2026-09-19 20:00:40', '390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','19-1,','1','1','0','0','6950','6950','0','','0','0.00','0','0','0','0'); -- id=389
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 389;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 20:00:41' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 20:00:41','0','0'); -- id=1038
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '59', '6', '389', '1.00', '2550', '2550', '0', '', '1', '2026-09-19 20:00:41', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=390
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 390;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 20:00:41' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-09-19 20:00:41','0','0'); -- id=1039
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2650','00234', '59', '10', '234', '1.00', '3100', '3100', '0', '', '1', '2026-09-19 20:00:41', '234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3100','3100','0','','0','0.00','0','0','0','0'); -- id=391
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 391;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-19 20:00:41' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-09-19 20:00:41','0','0'); -- id=1040
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '59', '14', '80', '0.25', '95', '23.75', '0', '', '1', '2026-09-19 20:00:41', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=392
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 392;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '9.25', userid = '1', storedetaildate = '2026-09-19 20:00:42' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9.5', '9.25', '1', '2026-09-19 20:00:42','0','0'); -- id=1041
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '59', '4', '371', '1.00', '12', '12', '0', '', '1', '2026-09-19 20:00:42', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=393
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 393;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '125', userid = '1', storedetaildate = '2026-09-19 20:00:42' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '125', '1', '2026-09-19 20:00:42','0','0'); -- id=1042
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '59', '3', '347', '3.00', '31', '93', '0', '', '1', '2026-09-19 20:00:42', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-3,','1','1','0','0','31','93','0','','0','0.00','0','0','0','0'); -- id=394
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 394;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-19 20:00:42' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '32', '1', '2026-09-19 20:00:42','0','0'); -- id=1043
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '59', '3', '102', '3.00', '12', '36', '0', '', '1', '2026-09-19 20:00:42', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-3,','1','1','0','0','12','36','0','','0','0.00','0','0','0','0'); -- id=395
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 395;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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+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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.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 = '1349', userid = '1', storedetaildate = '2026-09-19 20:00:43' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1352', '1349', '1', '2026-09-19 20:00:43','0','0'); -- id=1044
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '59', '3', '120', '3.00', '15.75', '47.25', '0', '', '1', '2026-09-19 20:00:43', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-3,','1','1','0','0','15.75','47.25','0','','0','0.00','0','0','0','0'); -- id=396
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 396;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.25, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-09-19 20:00:43' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-09-19 20:00:43','0','0'); -- id=1045
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '59', '3', '103', '6.00', '5.5', '33', '0', '', '1', '2026-09-19 20:00:43', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-6,','1','1','0','0','5.5','33','0','','0','0.00','0','0','0','0'); -- id=397
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 397;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2065', userid = '1', storedetaildate = '2026-09-19 20:00:43' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2071', '2065', '1', '2026-09-19 20:00:43','0','0'); -- id=1046
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00415', '59', '6', '415', '1.00', '120', '120', '0', '', '1', '2026-09-19 20:00:43', '415', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=398
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 398;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 20:00:44' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 20:00:44','0','0'); -- id=1047
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00416', '59', '6', '416', '1.00', '15', '15', '0', '', '1', '2026-09-19 20:00:44', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=399
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 399;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-19 20:00:44' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-09-19 20:00:44','0','0'); -- id=1048
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.3','00083', '59', '12', '83', '1.00', '45', '45', '0', '', '1', '2026-09-19 20:00:44', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=400
UPDATE sellbilldetail SET  lastbuyprice = 42.30 , meanbuyprice = 42.30, lastbuyprice_withDiscount = 42.30, meanbuyprice_withDiscount = 42.30
        , lastbuyprice_withTax = 42.3, meanbuyprice_withTax = 42.3, lastbuyprice_withDiscountAndTax = 42.3
                where sellbilldetailid = 400;
 INSERT INTO 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-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '139', userid = '1', storedetaildate = '2026-09-19 20:00:44' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '59', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '140', '139', '1', '2026-09-19 20:00:44','0','0'); -- id=1049
UPDATE dailyentry SET totalcreditor = '16963.50', totaldebtor = '16963.50', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 18:34:44', entryComment = 'اضافة فاتورة مبيعات رقم 57', fromFlag = '1',related='0',isopeningentry='0',operationId='57',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=57' WHERE id = '617';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16963.50', '16963.50', '2026-09-19', '1', '0', '617', '2026-09-19 20:00:45','تم عكس القيد رقم 617 ','1','0','0','0','0',''); -- id=622
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('622', '441', '16963.50', '','0'); -- id=622
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('622', '143', '16963.50', '','0'); -- id=622
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '166323.44', 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 = '15504.34', totaldebtor = '15504.34', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 18:34:44', entryComment = 'اضافة فاتورة مبيعات رقم 57 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='57',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=57' WHERE id = '618';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15504.34', '15504.34', '2026-09-19', '1', '0', '618', '2026-09-19 20:00:45','تم عكس القيد رقم 618 ','1','0','0','0','0',''); -- id=623
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('623', '402', '15504.34', '','0'); -- id=623
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '157505.27', 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 ('623', '382', '15504.34', '','0'); -- id=623
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2132371.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16978.1', '16978.1', '2026-09-19', '1', '0', '0', '2026-09-19 20:00:46','اضافة فاتورة مبيعات رقم 59','1','0',null,'0','59','sellbillController.php?do=showDetail&sellbillid=59'); -- id=624
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('624', '441', '16978.1', '','0'); -- id=624
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '17468.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('624', '143', '16978.1', '','0'); -- id=624
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '183301.54', 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 ( '15518.34', '15518.34', '2026-09-19', '1', '0', '0', '2026-09-19 20:00:46','اضافة فاتورة مبيعات رقم 59 - صرف البضاعة من المخزن','1','0',null,'0','59','sellbillController.php?do=showDetail&sellbillid=59'); -- id=625
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('625', '402', '15518.34', '','0'); -- id=625
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '173023.61', 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 ('625', '382', '15518.34', '','0'); -- id=625
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2116852.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='624,0,625' where sellbillid=59;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15518.59, 15518.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16978.1, sellCostBuyPrice =sellCostBuyPrice+15518.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15518.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15518.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15518.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15518.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15518.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15518.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15518.59
                        , returnSellVal = returnSellVal+0, 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 (13, '2026-09-19', 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15518.59, 15518.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16978.1, sellCostBuyPrice =sellCostBuyPrice+15518.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15518.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15518.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15518.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15518.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15518.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15518.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15518.59
                        , returnSellVal = returnSellVal+0, 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, 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34, 15518.59, 15518.59)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+16978.1, netSellCostBuyPrice = netSellCostBuyPrice+15518.84
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15518.34
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15518.59
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15518.34
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15518.59
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15518.34
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15518.59
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15518.59;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 57 and newid=59 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 16:30:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 20:00:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 20:00:47', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=59'); -- id=1625
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 17:59:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:29:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:29:28', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1626
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-09-19 21:30:55', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-19','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=15
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('15', '0', '0', '', ''); -- id=15
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 ('15','0','0','0','إضافة عميل جديد','15', '0', '2026-09-19 21:30:55', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=95
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-09-19 21:30:56'); -- id=443
UPDATE client SET clientname = 'سمير موسي ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-19', 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='443',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 = '15';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:01:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:31:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:31:25', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1627

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaee29916cce
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(15,@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-09-19 21:31:26', '06aaee29916cce', '15', '0.00', '0', '0', '1', '1170.00', '1170', '1170', '0', '1', '2026-09-19 21:31:26', '', '1', '0', 'سمير موسي ', '1', '1', '3', '0', 'سمير موسي ', '30' ,'0','','','','','-1','0','0','0','0','0','1170','0','','0','0','1170','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=60
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '15';
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 ('15','0.00','0','0','اضافة فاتورة مبيعات','60', '0', '2026-09-19 21:31:27', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1170', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 21:31:26','0','0','',''); -- id=96
UPDATE client SET  inUse = 0 where clientid = 15;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00271', '60', '10', '271', '30', '39', '1170', '0', '', '1', '2026-09-19 21:31:27', '271', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','1170','0','','0','0.00','0','0','0','0'); -- id=401
UPDATE sellbilldetail SET  lastbuyprice = 30.00 , meanbuyprice = 30.00, lastbuyprice_withDiscount = 30.00, meanbuyprice_withDiscount = 30.00
        , lastbuyprice_withTax = 30, meanbuyprice_withTax = 30, lastbuyprice_withDiscountAndTax = 30
                where sellbilldetailid = 401;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (271, '2026-09-19', 1170, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 1170, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2026-09-19 21:31:27' WHERE storedetailid = '271';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('271', '1', '30', '1', '60', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '70', '1', '2026-09-19 21:31:27','0','0'); -- id=1050
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-206943.984375',  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 ('-208113.984375','1170', '0', '1', 'اضافة فاتورة مبيعات', '60', '-206943.984375', '2026-09-19 21:31:27', '1',  'sellbillController.php','15','','0'); -- id=57
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1170', '1170', '2026-09-19', '1', '0', '0', '2026-09-19 21:31:27','اضافة فاتورة مبيعات رقم 60','1','0',null,'0','60','sellbillController.php?do=showDetail&sellbillid=60'); -- id=626
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('626', '443', '1170', '','0'); -- id=626
UPDATE accountstree SET name = 'سمير موسي ', customName = 'سمير موسي ', customNameEn = 'سمير موسي ', nameEn = 'سمير موسي ', parent = '58', accountNature = '0', theValue = '1170', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-19 21:30:56' WHERE id = '443';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('626', '143', '1170', '','0'); -- id=626
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '184471.54', 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 ( '1170', '1170', '2026-09-19', '1', '0', '0', '2026-09-19 21:31:27','اضافة فاتورة مبيعات رقم 60 - تحصيل الفاتورة من العميل','1','0',null,'0','60','sellbillController.php?do=showDetail&sellbillid=60'); -- id=627
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('627', '383', '1170', '','0'); -- id=627
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-160251.98', 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 ('627', '443', '1170', '','0'); -- id=627
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-09-19 21:30:56' WHERE id = '443';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '900', '900', '2026-09-19', '1', '0', '0', '2026-09-19 21:31:27','اضافة فاتورة مبيعات رقم 60 - صرف البضاعة من المخزن','1','0',null,'0','60','sellbillController.php?do=showDetail&sellbillid=60'); -- id=628
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('628', '402', '900', '','0'); -- id=628
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '173923.61', 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 ('628', '382', '900', '','0'); -- id=628
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2115952.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='626,627,628' where sellbillid=60;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 1170, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-09-19', 1170, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1170, 900, 900
                    , 900, 900, 900, 900, 900, 900)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1170, netSellCostBuyPrice = netSellCostBuyPrice+900
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+900
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+900
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+900
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+900
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+900
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+900
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+900;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaee29916cce and sellbillId = 60 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:01:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:31:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:31:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:01:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:31:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-19 21:31:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:02:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:32:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-19 21:32:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1630
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:03:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:33:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-19 21:33:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:03:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:33:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:33:33', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=59'); -- id=1632
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:04:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:34:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:34:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:04:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:34:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:34:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1634
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:04:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:34:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:34:24', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=59'); -- id=1635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:06:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:36:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:36:17', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1636
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 59;
UPDATE sellbill SET  sellbillsysdate = '2026-09-19 21:36:17', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '59';
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 381;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-56, sellCostBuyPrice =sellCostBuyPrice-52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-52, sellCostMeanBuyPrice = sellCostMeanBuyPrice-52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-52
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-19 21:36:17' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '45', '1', '2026-09-17 17:27:44','0','0'); -- id=1051
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 382;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3630, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-09-19 21:36:17' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-09-17 17:27:44','0','0'); -- id=1052
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 = 383;
 INSERT INTO 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-09-19', 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-09-19', 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 = '100', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '98', '100', '1', '2026-09-17 17:27:44','0','0'); -- id=1053
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 = 384;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '629', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '627', '629', '1', '2026-09-17 17:27:44','0','0'); -- id=1054
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 25;
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 385;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21, sellCostBuyPrice =sellCostBuyPrice-19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19.28
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1225', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1221', '1225', '1', '2026-09-17 17:27:44','0','0'); -- id=1055
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 = 386;
 INSERT INTO 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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-43.8, sellCostBuyPrice =sellCostBuyPrice-42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-43.8, sellCostBuyPrice =sellCostBuyPrice-42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '3', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '178', '181', '1', '2026-09-17 17:27:44','0','0'); -- id=1056
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 387;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=1057
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 = 388;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11.3, sellCostBuyPrice =sellCostBuyPrice-11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '160', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '159', '160', '1', '2026-09-17 17:27:44','0','0'); -- id=1058
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 19;
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 389;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6950, sellCostBuyPrice =sellCostBuyPrice-6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=1059
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 18;
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 390;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2550, sellCostBuyPrice =sellCostBuyPrice-2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2350
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-09-17 17:27:44','0','0'); -- id=1060
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 391;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3100, sellCostBuyPrice =sellCostBuyPrice-2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2650
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-17 17:27:44','0','0'); -- id=1061
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 392;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,0.25,0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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-0.25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23.75, sellCostBuyPrice =sellCostBuyPrice-20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20.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 = '9.5', userid = '1', storedetaildate = '2026-09-19 21:36:18' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9.25', '9.5', '1', '2026-09-17 17:27:44','0','0'); -- id=1062
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 393;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12, sellCostBuyPrice =sellCostBuyPrice-10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10.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 = '126', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '125', '126', '1', '2026-09-17 17:27:44','0','0'); -- id=1063
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 21;
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 394;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93, sellCostBuyPrice =sellCostBuyPrice-89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice-89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-89.31
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '35', '1', '2026-09-17 17:27:44','0','0'); -- id=1064
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 11;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 395;
 INSERT INTO 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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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-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-09-19', 36, 35.25, 35.25
                    , 35.25, 35.25, 35.25, 35.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.25, 35.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-35.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35.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 = '1352', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '3', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1349', '1352', '1', '2026-09-17 17:27:44','0','0'); -- id=1065
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 10;
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 396;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-19', 47.25, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.25, sellCostBuyPrice =sellCostBuyPrice-45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-45
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '3', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-09-17 17:27:44','0','0'); -- id=1066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 397;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-33, sellCostBuyPrice =sellCostBuyPrice-27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-27, sellCostMeanBuyPrice = sellCostMeanBuyPrice-27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-27
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2071', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2065', '2071', '1', '2026-09-17 17:27:44','0','0'); -- id=1067
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 398;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-115, sellCostMeanBuyPrice = sellCostMeanBuyPrice-115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-115
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '2', '1', '2026-09-17 17:27:44','0','0'); -- id=1068
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 399;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-09-17 17:27:44','0','0'); -- id=1069
UPDATE sellbilldetail SET  lastbuyprice = 42.30 , meanbuyprice = 42.30, lastbuyprice_withDiscount = 42.30, meanbuyprice_withDiscount = 42.30
        , lastbuyprice_withTax = 42.3, meanbuyprice_withTax = 42.3, lastbuyprice_withDiscountAndTax = 42.3
                where sellbilldetailid = 400;
 INSERT INTO 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-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-42.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '140', userid = '1', storedetaildate = '2026-09-19 21:36:19' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '0', '59', 'تعديل فاتورة مبيعات', 'sellbillController.php', '139', '140', '1', '2026-09-17 17:27:44','0','0'); -- id=1070
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '490', userid = '1' WHERE clientid = '13';
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 ('13','17468.10','16978.10','1','تعديل فاتورة مبيعات','59', '490', '2026-09-17 17:27:44', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '16978.1', '0', null, '0', null, null,'', '0','1','1','16978.1','1','2026-09-17 17:27:44','0','0','',''); -- id=97
UPDATE client SET  inUse = 0 where clientid = 13;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15518.59, 15518.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16978.1, sellCostBuyPrice =sellCostBuyPrice-15518.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15518.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15518.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15518.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15518.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15518.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15518.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15518.59
                        , returnSellVal = returnSellVal-0, 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 (13, '2026-09-19', 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15518.59, 15518.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-16978.1, sellCostBuyPrice =sellCostBuyPrice-15518.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-15518.34, sellCostMeanBuyPrice = sellCostMeanBuyPrice-15518.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-15518.34, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-15518.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-15518.34
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-15518.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-15518.59
                        , returnSellVal = returnSellVal-0, 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, 16978.1, 15518.84, 15518.34
                    , 15518.59, 15518.34, 15518.59, 15518.34, 15518.59, 15518.59)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-16978.1, netSellCostBuyPrice = netSellCostBuyPrice-15518.84
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-15518.34
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-15518.59
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-15518.34
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-15518.59
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-15518.34
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-15518.59
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-15518.59;

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


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

COMMIT;
BEGIN;
CALL clientInUse(13,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-17 17:27:44', '06aac063beed8d', '13', '490.00', '17572.4', '0', '1', '17082.4', '17082.4', '0', '17082.4', '1', '2026-09-17 17:27:44', '', '1', '0', 'ابراهيم صلاح ', '1', '1', '3', '0', '13 - ابراهيم صلاح ', '47.25', '59', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-17','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=61
UPDATE client SET  clientdebt = '17572.4', userid = '1' WHERE clientid = '13';
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 ('13','490.00','17082.4','0','اضافة فاتورة مبيعات (معدله)','61', '17572.4', '2026-09-19 21:36:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '17082.4', '0', null, '0', null, null,'', '0','1','1','16978.1','1','2026-09-17 17:27:44','0','0','',''); -- id=98
UPDATE client SET  inUse = 0 where clientid = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '61', '12', '395', '2.00', '28', '56', '0', '', '1', '2026-09-19 21:36:20', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=402
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 402;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 56, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-19 21:36:21' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '2', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '43', '1', '2026-09-19 21:36:21','0','0'); -- id=1071
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '61', '10', '208', '3.00', '1210', '3630', '0', '', '1', '2026-09-19 21:36:21', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','3630','0','','0','0.00','0','0','0','0'); -- id=403
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 403;
 INSERT INTO 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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3630, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3630, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-09-19 21:36:21' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-09-19 21:36:21','0','0'); -- id=1072
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '61', '12', '82', '2.00', '34', '68', '0', '', '1', '2026-09-19 21:36:21', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=404
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 = 404;
 INSERT INTO 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-09-19', 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-09-19', 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 = '98', userid = '1', storedetaildate = '2026-09-19 21:36:21' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '2', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '98', '1', '2026-09-19 21:36:21','0','0'); -- id=1073
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '61', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-09-19 21:36:21', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=405
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 = 405;
 INSERT INTO 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-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '627', userid = '1', storedetaildate = '2026-09-19 21:36:22' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '629', '627', '1', '2026-09-19 21:36:22','0','0'); -- id=1074
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 25;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.82','00388', '61', '20', '388', '4.00', '5.25', '21', '0', '', '1', '2026-09-19 21:36:22', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-4,','1','1','0','0','5.25','21','0','','0','0.00','0','0','0','0'); -- id=406
UPDATE sellbilldetail SET  lastbuyprice = 4.82 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.82, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.82, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.82
                where sellbilldetailid = 406;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (388, '2026-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 21, 19.28, 19.28
                    , 19.28, 19.28, 19.28, 19.28
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19.28, 19.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21, sellCostBuyPrice =sellCostBuyPrice+19.28
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19.28, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19.28, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19.28
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1221', userid = '1', storedetaildate = '2026-09-19 21:36:22' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '4', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1225', '1221', '1', '2026-09-19 21:36:22','0','0'); -- id=1075
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '61', '4', '279', '3.00', '14.6', '43.8', '0', '', '1', '2026-09-19 21:36:22', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.6','43.8','0','','0','0.00','0','0','0','0'); -- id=407
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 = 407;
 INSERT INTO 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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+43.8, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 43.8, 42, 42
                    , 42, 42, 42, 42
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42, 42, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+43.8, sellCostBuyPrice =sellCostBuyPrice+42
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '178', userid = '1', storedetaildate = '2026-09-19 21:36:22' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '3', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '178', '1', '2026-09-19 21:36:22','0','0'); -- id=1076
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '61', '6', '211', '1.00', '85', '85', '0', '', '1', '2026-09-19 21:36:22', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=408
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 408;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-19 21:36:23' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-09-19 21:36:23','0','0'); -- id=1077
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '61', '12', '87', '1.00', '11.3', '11.3', '0', '', '1', '2026-09-19 21:36:23', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','11.3','0','','0','0.00','0','0','0','0'); -- id=409
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 = 409;
 INSERT INTO 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-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 11.3, 11.1, 11.1
                    , 11.1, 11.1, 11.1, 11.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.1, 11.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11.3, sellCostBuyPrice =sellCostBuyPrice+11.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-09-19 21:36:23' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '160', '159', '1', '2026-09-19 21:36:23','0','0'); -- id=1078
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 19;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6762','00390', '61', '6', '390', '1.00', '6950', '6950', '0', '', '1', '2026-09-19 21:36:23', '390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','19-1,','1','1','0','0','6950','6950','0','','0','0.00','0','0','0','0'); -- id=410
UPDATE sellbilldetail SET  lastbuyprice = 6762.00 , meanbuyprice = 6762.00, lastbuyprice_withDiscount = 6762.00, meanbuyprice_withDiscount = 6762.00
        , lastbuyprice_withTax = 6762, meanbuyprice_withTax = 6762, lastbuyprice_withDiscountAndTax = 6762
                where sellbilldetailid = 410;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (390, '2026-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 6950, 6762, 6762
                    , 6762, 6762, 6762, 6762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6762, 6762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6950, sellCostBuyPrice =sellCostBuyPrice+6762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 21:36:23' WHERE storedetailid = '390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('390', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 21:36:24','0','0'); -- id=1079
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '61', '6', '389', '1.00', '2550', '2550', '0', '', '1', '2026-09-19 21:36:24', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=411
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 411;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 2550, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-19 21:36:24' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-09-19 21:36:24','0','0'); -- id=1080
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2650','00234', '61', '10', '234', '1.00', '3100', '3100', '0', '', '1', '2026-09-19 21:36:24', '234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3100','3100','0','','0','0.00','0','0','0','0'); -- id=412
UPDATE sellbilldetail SET  lastbuyprice = 2650.00 , meanbuyprice = 2650.00, lastbuyprice_withDiscount = 2650.00, meanbuyprice_withDiscount = 2650.00
        , lastbuyprice_withTax = 2650, meanbuyprice_withTax = 2650, lastbuyprice_withDiscountAndTax = 2650
                where sellbilldetailid = 412;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (234, '2026-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3100, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3100, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-19 21:36:24' WHERE storedetailid = '234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('234', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1', '0', '1', '2026-09-19 21:36:24','0','0'); -- id=1081
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '61', '14', '80', '0.25', '95', '23.75', '0', '', '1', '2026-09-19 21:36:24', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','23.75','0','','0','0.00','0','0','0','0'); -- id=413
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 413;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 23.75, 20.5, 20.5
                    , 20.5, 20.5, 20.5, 20.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20.5, 20.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23.75, sellCostBuyPrice =sellCostBuyPrice+20.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20.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 = '9.25', userid = '1', storedetaildate = '2026-09-19 21:36:25' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.25', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9.5', '9.25', '1', '2026-09-19 21:36:25','0','0'); -- id=1082
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00371', '61', '4', '371', '1.00', '12', '12', '0', '', '1', '2026-09-19 21:36:25', '371', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=414
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.25, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.25
        , lastbuyprice_withTax = 10.25, meanbuyprice_withTax = 10.25, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 414;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (371, '2026-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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-09-19', 12, 10.5, 10
                    , 10.25, 10, 10.25, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.25, 10.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+10.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.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 = '125', userid = '1', storedetaildate = '2026-09-19 21:36:25' WHERE storedetailid = '371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('371', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '126', '125', '1', '2026-09-19 21:36:25','0','0'); -- id=1083
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.77','00347', '61', '3', '347', '3.00', '31', '93', '0', '', '1', '2026-09-19 21:36:25', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-3,','1','1','0','0','31','93','0','','0','0.00','0','0','0','0'); -- id=415
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 415;
 INSERT INTO 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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 93, 89.31, 89.31
                    , 89.31, 89.31, 89.31, 89.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 89.31, 89.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93, sellCostBuyPrice =sellCostBuyPrice+89.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+89.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+89.31
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+89.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+89.31
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+89.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+89.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+89.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-19 21:36:25' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '3', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '32', '1', '2026-09-19 21:36:25','0','0'); -- id=1084
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '61', '3', '102', '4', '12', '48', '0', '', '1', '2026-09-19 21:36:25', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-4,','1','1','0','0','12','48','0','','0','0.00','0','0','0','0'); -- id=416
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 416;
 INSERT INTO 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-09-19', 48, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 48, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1348', userid = '1', storedetaildate = '2026-09-19 21:36:26' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '4', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1352', '1348', '1', '2026-09-19 21:36:26','0','0'); -- id=1085
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '61', '3', '120', '4', '15.75', '63', '0', '', '1', '2026-09-19 21:36:26', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-4,','1','1','0','0','15.75','63','0','','0','0.00','0','0','0','0'); -- id=417
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 417;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-19', 63, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+63, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-19', 63, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+63, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '273', userid = '1', storedetaildate = '2026-09-19 21:36:26' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '4', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '273', '1', '2026-09-19 21:36:26','0','0'); -- id=1086
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '61', '3', '103', '6.00', '5.5', '33', '0', '', '1', '2026-09-19 21:36:26', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-6,','1','1','0','0','5.5','33','0','','0','0.00','0','0','0','0'); -- id=418
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 418;
 INSERT INTO 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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 33, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2065', userid = '1', storedetaildate = '2026-09-19 21:36:26' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '6', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2071', '2065', '1', '2026-09-19 21:36:26','0','0'); -- id=1087
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00415', '61', '6', '415', '1.00', '120', '120', '0', '', '1', '2026-09-19 21:36:26', '415', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=419
UPDATE sellbilldetail SET  lastbuyprice = 115.00 , meanbuyprice = 115.00, lastbuyprice_withDiscount = 115.00, meanbuyprice_withDiscount = 115.00
        , lastbuyprice_withTax = 115, meanbuyprice_withTax = 115, lastbuyprice_withDiscountAndTax = 115
                where sellbilldetailid = 419;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (415, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 120, 115, 115
                    , 115, 115, 115, 115
                    , 0, 0, 0, 0
                    , 0, 0, 0, 115, 115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-19 21:36:27' WHERE storedetailid = '415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('415', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2', '1', '1', '2026-09-19 21:36:27','0','0'); -- id=1088
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00416', '61', '6', '416', '1.00', '15', '15', '0', '', '1', '2026-09-19 21:36:27', '416', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=420
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 420;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (416, '2026-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 15, 13, 13
                    , 13, 13, 13, 13
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-19 21:36:27' WHERE storedetailid = '416';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('416', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-09-19 21:36:27','0','0'); -- id=1089
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.3','00083', '61', '12', '83', '1.00', '45', '45', '0', '', '1', '2026-09-19 21:36:27', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=421
UPDATE sellbilldetail SET  lastbuyprice = 42.30 , meanbuyprice = 42.30, lastbuyprice_withDiscount = 42.30, meanbuyprice_withDiscount = 42.30
        , lastbuyprice_withTax = 42.3, meanbuyprice_withTax = 42.3, lastbuyprice_withDiscountAndTax = 42.3
                where sellbilldetailid = 421;
 INSERT INTO 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-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 45, 42.3, 42.3
                    , 42.3, 42.3, 42.3, 42.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 42.3, 42.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+42.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+42.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+42.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+42.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+42.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+42.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+42.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+42.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '139', userid = '1', storedetaildate = '2026-09-19 21:36:27' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '140', '139', '1', '2026-09-19 21:36:27','0','0'); -- id=1090
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.5','00296', '61', '6', '296', '1', '9', '9', '0', '', '1', '2026-09-19 21:36:27', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=422
UPDATE sellbilldetail SET  lastbuyprice = 7.50 , meanbuyprice = 7.50, lastbuyprice_withDiscount = 7.50, meanbuyprice_withDiscount = 7.50
        , lastbuyprice_withTax = 7.5, meanbuyprice_withTax = 7.5, lastbuyprice_withDiscountAndTax = 7.5
                where sellbilldetailid = 422;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-09-19', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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-09-19', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.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 = '71', userid = '1', storedetaildate = '2026-09-19 21:36:28' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '72', '71', '1', '2026-09-19 21:36:28','0','0'); -- id=1091
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '61', '3', '100', '1', '17.75', '17.75', '0', '', '1', '2026-09-19 21:36:28', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','13-1,','1','1','0','0','17.75','17.75','0','','0','0.00','0','0','0','0'); -- id=423
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 423;
 INSERT INTO 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-09-19', 17.75, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17.75, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.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+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-09-19', 17.75, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17.75, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.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 = '366', userid = '1', storedetaildate = '2026-09-19 21:36:28' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '367', '366', '1', '2026-09-19 21:36:28','0','0'); -- id=1092
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00101', '61', '3', '101', '2', '17.75', '35.5', '0', '', '1', '2026-09-19 21:36:28', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17.75','35.5','0','','0','0.00','0','0','0','0'); -- id=424
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 424;
 INSERT INTO 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-09-19', 35.5, 35.2, 35.2
                    , 35.2, 35.2, 35.2, 35.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 35.2, 35.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+35.5, sellCostBuyPrice =sellCostBuyPrice+35.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 35.5, 35.2, 35.2
                    , 35.2, 35.2, 35.2, 35.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.2, 35.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+35.5, sellCostBuyPrice =sellCostBuyPrice+35.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '420', userid = '1', storedetaildate = '2026-09-19 21:36:28' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '2', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '422', '420', '1', '2026-09-19 21:36:28','0','0'); -- id=1093
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '61', '4', '280', '1', '14.3', '14.3', '0', '', '1', '2026-09-19 21:36:28', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.3','14.3','0','','0','0.00','0','0','0','0'); -- id=425
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 = 425;
 INSERT INTO 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-09-19', 14.3, 13.8, 13.8
                    , 13.8, 13.8, 13.8, 13.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 13.8, 13.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.3, sellCostBuyPrice =sellCostBuyPrice+13.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-19', 14.3, 13.8, 13.8
                    , 13.8, 13.8, 13.8, 13.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13.8, 13.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.3, sellCostBuyPrice =sellCostBuyPrice+13.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.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 = '240', userid = '1', storedetaildate = '2026-09-19 21:36:29' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '1', '1', '61', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '241', '240', '1', '2026-09-19 21:36:29','0','0'); -- id=1094
UPDATE dailyentry SET totalcreditor = '16978.10', totaldebtor = '16978.10', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 20:00:46', entryComment = 'اضافة فاتورة مبيعات رقم 59', fromFlag = '1',related='0',isopeningentry='0',operationId='59',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=59' WHERE id = '624';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16978.10', '16978.10', '2026-09-19', '1', '0', '624', '2026-09-19 21:36:29','تم عكس القيد رقم 624 ','1','0','0','0','0',''); -- id=629
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('629', '441', '16978.10', '','0'); -- id=629
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '490', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('629', '143', '16978.10', '','0'); -- id=629
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '167493.44', 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 = '15518.34', totaldebtor = '15518.34', thedate = '2026-09-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-19 20:00:46', entryComment = 'اضافة فاتورة مبيعات رقم 59 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='59',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=59' WHERE id = '625';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15518.34', '15518.34', '2026-09-19', '1', '0', '625', '2026-09-19 21:36:29','تم عكس القيد رقم 625 ','1','0','0','0','0',''); -- id=630
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('630', '402', '15518.34', '','0'); -- id=630
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '158405.27', 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 ('630', '382', '15518.34', '','0'); -- id=630
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2131471.3', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17082.4', '17082.4', '2026-09-19', '1', '0', '0', '2026-09-19 21:36:30','اضافة فاتورة مبيعات رقم 61','1','0',null,'0','61','sellbillController.php?do=showDetail&sellbillid=61'); -- id=631
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('631', '441', '17082.4', '','0'); -- id=631
UPDATE accountstree SET name = 'ابراهيم صلاح ', customName = 'ابراهيم صلاح ', customNameEn = 'ابراهيم صلاح ', nameEn = 'ابراهيم صلاح ', parent = '58', accountNature = '0', theValue = '17572.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-17 17:23:23' WHERE id = '441';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('631', '143', '17082.4', '','0'); -- id=631
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '184575.84', 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 ( '15619.19', '15619.19', '2026-09-19', '1', '0', '0', '2026-09-19 21:36:30','اضافة فاتورة مبيعات رقم 61 - صرف البضاعة من المخزن','1','0',null,'0','61','sellbillController.php?do=showDetail&sellbillid=61'); -- id=632
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('632', '402', '15619.19', '','0'); -- id=632
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '174024.46', 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 ('632', '382', '15619.19', '','0'); -- id=632
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2115852.11', 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='631,0,632' where sellbillid=61;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 17082.4, 15619.69, 15619.19
                    , 15619.44, 15619.19, 15619.44, 15619.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15619.44, 15619.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17082.4, sellCostBuyPrice =sellCostBuyPrice+15619.69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15619.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15619.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15619.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15619.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15619.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15619.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15619.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-09-19', 17082.4, 15619.69, 15619.19
                    , 15619.44, 15619.19, 15619.44, 15619.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15619.44, 15619.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17082.4, sellCostBuyPrice =sellCostBuyPrice+15619.69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15619.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15619.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15619.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15619.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15619.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15619.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15619.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 17082.4, 15619.69, 15619.19
                    , 15619.44, 15619.19, 15619.44, 15619.19, 15619.44, 15619.44)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17082.4, netSellCostBuyPrice = netSellCostBuyPrice+15619.69
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15619.19
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15619.44
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15619.19
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15619.44
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15619.19
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15619.44
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15619.44;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 59 and newid=61 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:06:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:36:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:36:31', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=61'); -- id=1637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:13:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:43:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:43:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:19:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:49:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:49:28', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1639

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaee5c639bcd
-- ----------------------------------------------------------------------------------------------------

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-09-19 21:49:29', '06aaee5c639bcd', '1', '0.00', '0', '0', '1', '3589.00', '3589', '3589', '0', '1', '2026-09-19 21:49:29', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','3589','0','','0','0','3589','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-19','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=62
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','اضافة فاتورة مبيعات','62', '0', '2026-09-19 21:49:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3589', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-19 21:49:29','0','0','',''); -- id=99
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '62', '10', '208', '3', '1190', '3570', '0', '', '1', '2026-09-19 21:49:30', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1190','3570','0','','0','','0','0','0','0'); -- id=426
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 426;
 INSERT INTO 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-09-19', 3570, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3570, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-19', 3570, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3570, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '55', userid = '1', storedetaildate = '2026-09-19 21:49:30' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '1', '62', 'اضافة فاتورة مبيعات', 'sellbillController.php', '58', '55', '1', '2026-09-19 21:49:30','0','0'); -- id=1095
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '62', '14', '81', '1', '19', '19', '0', '', '1', '2026-09-19 21:49:30', '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=427
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 = 427;
 INSERT INTO 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-09-19', 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-09-19', 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 = '626', userid = '1', storedetaildate = '2026-09-19 21:49:30' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '62', 'اضافة فاتورة مبيعات', 'sellbillController.php', '627', '626', '1', '2026-09-19 21:49:30','0','0'); -- id=1096
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-203354.984375',  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 ('-206943.984375','3589', '0', '1', 'اضافة فاتورة مبيعات', '62', '-203354.984375', '2026-09-19 21:49:30', '1',  'sellbillController.php','1','','0'); -- id=58
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3589', '3589', '2026-09-19', '1', '0', '0', '2026-09-19 21:49:31','اضافة فاتورة مبيعات رقم 62','1','0',null,'0','62','sellbillController.php?do=showDetail&sellbillid=62'); -- id=633
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('633', '383', '3589', '','0'); -- id=633
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-156662.98', 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 ('633', '143', '3589', '','0'); -- id=633
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '188164.84', 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 ( '3078', '3078', '2026-09-19', '1', '0', '0', '2026-09-19 21:49:31','اضافة فاتورة مبيعات رقم 62 - صرف البضاعة من المخزن','1','0',null,'0','62','sellbillController.php?do=showDetail&sellbillid=62'); -- id=634
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('634', '402', '3078', '','0'); -- id=634
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '177102.46', 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 ('634', '382', '3078', '','0'); -- id=634
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2112774.11', 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='633,0,634' where sellbillid=62;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-19', 3589, 3078, 3078
                    , 3078, 3078, 3078, 3078
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3078, 3078, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3589, sellCostBuyPrice =sellCostBuyPrice+3078
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3078, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3078
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3078, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3078
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3078
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3078
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3078
                        , returnSellVal = returnSellVal+0, 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-09-19', 3589, 3078, 3078
                    , 3078, 3078, 3078, 3078
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3078, 3078, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3589, sellCostBuyPrice =sellCostBuyPrice+3078
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3078, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3078
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3078, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3078
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3078
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3078
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3078
                        , returnSellVal = returnSellVal+0, 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, 3589, 3078, 3078
                    , 3078, 3078, 3078, 3078, 3078, 3078)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3589, netSellCostBuyPrice = netSellCostBuyPrice+3078
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3078
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3078
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3078
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3078
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3078
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3078
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3078;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaee5c639bcd and sellbillId = 62 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:19:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 21:49:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-19 21:49:32', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1640
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:45:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 22:15:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2026-09-19 22:15:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/salesreport.php'); -- id=1641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:45:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 22:15:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-19 22:15:33', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=1642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-19 18:45:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-19 22:15:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-19 22:15:44', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=1643
