UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:36:54";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:37:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:07:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-10 09:07:05', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=3842
UPDATE programsettings SET companyname = 'الشاذلي للاضاءه الحديثه', address = ' العنوان :كفر بهيده بجوار المستشفي<br/> المرتجع خلال 3 اشهورمن تاريخ الفاتوره<br/>الا الاسلاك خلال 20يوم<br/>ممنوع رجوع الاسلاك والليد المفتوح', specializtion = '', phone = '01096879556-01091024885', faxnumber = '', email = 'mousa_maged@hotmail.com', website = '', logo = 'a5583ab9a3a85fbef9bfbbd46031c2d2.jpeg', roundnumbers = '1', saveprinting = '1', deptprinting = '1', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '2',clientsearchvalue = '2', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = 'D', taxcard = '123456789123', commercialregistration = '1234', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2026-10-10',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='9aad922c8dc25742295df2779fde48ab62230719d569b9aa71bf6d5e0e08471c7dbda60d508155af60894a0ba3bbd86ffbee699027a409bcd9ca11e28a846cc5',associatedtags='0',commentClientChasis='0',dollarExType='64',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0'
                ,reviewRecords='',reviewRecordsLastDate='0000-00-00',showepayrestaurant='0',showSellAllPriceInStoreDetail='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:37:09";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-10 09:07:09', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=3843
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:37:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:07:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:07:15', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3844
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:39:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:09:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:09:51', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3845

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac9e424487f0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 09:09:52', '06ac9e424487f0', '6', '0.00', '6861', '0', '1', '6861.00', '6861', '0', '6861', '1', '2026-10-10 09:09:52', '', '1', '0', 'عمرو خطاب ', '1', '1', '3', '0', 'عمرو خطاب ', '79' ,'0','','','','','-1','0','0','0','0','0','6861','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=260
UPDATE client SET  clientdebt = '6861', userid = '1' WHERE clientid = '6';
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 ('6','0.00','6861','0','اضافة فاتورة مبيعات','260', '6861', '2026-10-10 09:09:53', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6861', '0', null, '0', null, null,'', '0','1','1','6861','1','2026-10-10 09:09:52','0','0','',''); -- id=433
UPDATE client SET  inUse = 0 where clientid = 6;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '260', '7', '318', '17', '73', '1241', '0', '', '0', '2026-10-10 09:09:53', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','17-5,','1','1','0','0','73','1241','0','','0','','0','0','0','0'); -- id=2160
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 2160;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+17
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-10 09:09:53' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '17', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '16', '1', '2026-10-10 09:09:53','0','0'); -- id=4022
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00284', '260', '7', '284', '7', '150', '1050', '0', '', '0', '2026-10-10 09:09:53', '284', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','150','1050','0','','0','','0','0','0','0'); -- id=2161
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 = 2161;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-10 09:09:53' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '7', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '22', '15', '1', '2026-10-10 09:09:53','0','0'); -- id=4023
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 53;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('212','00453', '260', '6', '453', '4', '235', '940', '0', '', '0', '2026-10-10 09:09:53', '453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','53-4,','1','1','0','0','235','940','0','','0','','0','0','0','0'); -- id=2162
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 2162;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-10 09:09:54' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '4', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '32', '1', '2026-10-10 09:09:54','0','0'); -- id=4024
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25.7','00092', '260', '18', '92', '20', '26', '520', '0', '', '0', '2026-10-10 09:09:54', '92', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5-20,','1','1','0','0','26','520','0','','0','0.00','0','0','0','0'); -- id=2163
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 2163;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-10 09:09:54' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '20', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '41', '21', '1', '2026-10-10 09:09:54','0','0'); -- id=4025
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '260', '10', '251', '1', '2230', '2230', '0', '', '0', '2026-10-10 09:09:54', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','2230','2230','0','','0','0.00','0','0','0','0'); -- id=2164
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 = 2164;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-10', 2230, 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+2230, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 2230, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2230, 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 = '37', userid = '1', storedetaildate = '2026-10-10 09:09:54' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '38', '37', '1', '2026-10-10 09:09:54','0','0'); -- id=4026
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.25','00240', '260', '2', '240', '20', '27', '540', '0', '', '0', '2026-10-10 09:09:54', '240', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','27','540','0','','0','0.00','0','0','0','0'); -- id=2165
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2165;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '210', userid = '1', storedetaildate = '2026-10-10 09:09:55' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '230', '210', '1', '2026-10-10 09:09:55','0','0'); -- id=4027
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '260', '12', '82', '10', '34', '340', '0', '', '0', '2026-10-10 09:09:55', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-10,','1','1','0','0','34','340','0','','0','0.00','0','0','0','0'); -- id=2166
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 = 2166;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '313', userid = '1', storedetaildate = '2026-10-10 09:09:55' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '323', '313', '1', '2026-10-10 09:09:55','0','0'); -- id=4028
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6861', '6861', '2026-10-10', '1', '0', '0', '2026-10-10 09:09:55','اضافة فاتورة مبيعات رقم 260','1','0',null,'0','260','sellbillController.php?do=showDetail&sellbillid=260'); -- id=1475
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1475', '431', '6861', '','0'); -- id=1485
UPDATE accountstree SET name = 'عمرو خطاب ', customName = 'عمرو خطاب ', customNameEn = 'عمرو خطاب ', nameEn = 'عمرو خطاب ', parent = '58', accountNature = '0', theValue = '6861', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 15:37:35' WHERE id = '431';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1475', '143', '6861', '','0'); -- id=1477
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1122375.72', 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 ( '6181.5', '6181.5', '2026-10-10', '1', '0', '0', '2026-10-10 09:09:55','اضافة فاتورة مبيعات رقم 260 - صرف البضاعة من المخزن','1','0',null,'0','260','sellbillController.php?do=showDetail&sellbillid=260'); -- id=1476
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1476', '402', '6181.5', '','0'); -- id=1486
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1007622.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1476', '382', '6181.5', '','0'); -- id=1478
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2418731.97', 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='1475,0,1476' where sellbillid=260;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6181.5, 6169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6861, sellCostBuyPrice =sellCostBuyPrice+6181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6169.26
                        , returnSellVal = returnSellVal+0, 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 (6, '2026-10-10', 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6181.5, 6169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6861, sellCostBuyPrice =sellCostBuyPrice+6181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6169.26
                        , returnSellVal = returnSellVal+0, 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, 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5, 6181.5, 6169.26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6861, netSellCostBuyPrice = netSellCostBuyPrice+6181.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6181.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6169.26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6181.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6169.26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6181.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6181.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6169.26;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac9e424487f0 and sellbillId = 260 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:39:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:09:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:09:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:42:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:12:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:12:57', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3847

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ac9e4c5cf090
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(34,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 09:12:58', '06ac9e4c5cf090', '34', '0.00', '1829', '0', '1', '1829.00', '1829', '0', '1829', '1', '2026-10-10 09:12:58', '', '1', '0', 'محمود شلبي', '1', '1', '3', '0', 'محمود شلبي', '60' ,'0','','','','','-1','0','0','0','0','0','1829','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=261
UPDATE client SET  clientdebt = '1829', userid = '1' WHERE clientid = '34';
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 ('34','0.00','1829','0','اضافة فاتورة مبيعات','261', '1829', '2026-10-10 09:12:58', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1829', '0', null, '0', null, null,'', '0','1','1','1829','1','2026-10-10 09:12:58','0','0','',''); -- id=434
UPDATE client SET  inUse = 0 where clientid = 34;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26.25','00240', '261', '2', '240', '20', '27', '540', '0', '', '0', '2026-10-10 09:12:59', '240', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','27','540','0','','0','0.00','0','0','0','0'); -- id=2167
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2167;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '190', userid = '1', storedetaildate = '2026-10-10 09:12:59' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '210', '190', '1', '2026-10-10 09:12:59','0','0'); -- id=4029
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21.5','00168', '261', '2', '168', '10', '25', '250', '0', '', '0', '2026-10-10 09:12:59', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','25','250','0','','0','0.00','0','0','0','0'); -- id=2168
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 2168;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-10-10', 250, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 250, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '218', userid = '1', storedetaildate = '2026-10-10 09:12:59' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '10', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '228', '218', '1', '2026-10-10 09:12:59','0','0'); -- id=4030
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '261', '14', '81', '10', '18.5', '185', '0', '', '0', '2026-10-10 09:12:59', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','185','0','','0','0.00','0','0','0','0'); -- id=2169
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 = 2169;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-10', 185, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+185, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 185, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+185, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '172', userid = '1', storedetaildate = '2026-10-10 09:13:00' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '182', '172', '1', '2026-10-10 09:13:00','0','0'); -- id=4031
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 40;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('64','00170', '261', '2', '170', '5', '75', '375', '0', '', '0', '2026-10-10 09:13:00', '170', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','40-5,','1','1','0','0','75','375','0','','0','0.00','0','0','0','0'); -- id=2170
UPDATE sellbilldetail SET  lastbuyprice = 64.00 , meanbuyprice = 64.00, lastbuyprice_withDiscount = 64.00, meanbuyprice_withDiscount = 64.00
        , lastbuyprice_withTax = 64, meanbuyprice_withTax = 64, lastbuyprice_withDiscountAndTax = 64
                where sellbilldetailid = 2170;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (170, '2026-10-10', 375, 320, 320
                    , 320, 320, 320, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 320, 320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 375, 320, 320
                    , 320, 320, 320, 320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 320, 320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '1', storedetaildate = '2026-10-10 09:13:00' WHERE storedetailid = '170';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('170', '1', '5', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '146', '141', '1', '2026-10-10 09:13:00','0','0'); -- id=4032
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.27','00321', '261', '18', '321', '10', '7.9', '79', '0', '', '0', '2026-10-10 09:13:00', '321', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','7.9','79','0','','0','0.00','0','0','0','0'); -- id=2171
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.14, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.14
        , lastbuyprice_withTax = 7.14, meanbuyprice_withTax = 7.14, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2171;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (321, '2026-10-10', 79, 72.7, 70
                    , 71.4, 70, 71.4, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 71.4, 71.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79, sellCostBuyPrice =sellCostBuyPrice+72.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.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+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 79, 72.7, 70
                    , 71.4, 70, 71.4, 70
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.4, 71.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79, sellCostBuyPrice =sellCostBuyPrice+72.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.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 = '105', userid = '1', storedetaildate = '2026-10-10 09:13:00' WHERE storedetailid = '321';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('321', '1', '10', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '115', '105', '1', '2026-10-10 09:13:00','0','0'); -- id=4033
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 22;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('78.4','00386', '261', '3', '386', '5', '80', '400', '0', '', '0', '2026-10-10 09:13:00', '386', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','22-5,','1','1','0','0','80','400','0','','0','0.00','0','0','0','0'); -- id=2172
UPDATE sellbilldetail SET  lastbuyprice = 78.40 , meanbuyprice = 78.40, lastbuyprice_withDiscount = 78.40, meanbuyprice_withDiscount = 78.40
        , lastbuyprice_withTax = 78.4, meanbuyprice_withTax = 78.4, lastbuyprice_withDiscountAndTax = 78.4
                where sellbilldetailid = 2172;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (386, '2026-10-10', 400, 392, 392
                    , 392, 392, 392, 392
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 392, 392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+392, sellCostMeanBuyPrice = sellCostMeanBuyPrice+392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+392
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 400, 392, 392
                    , 392, 392, 392, 392
                    , 0, 0, 0, 0
                    , 0, 0, 0, 392, 392, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+392
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+392, sellCostMeanBuyPrice = sellCostMeanBuyPrice+392
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+392, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+392
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+392
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+392
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+392
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-10-10 09:13:01' WHERE storedetailid = '386';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '1', '5', '1', '261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '34', '1', '2026-10-10 09:13:01','0','0'); -- id=4034
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1829', '1829', '2026-10-10', '1', '0', '0', '2026-10-10 09:13:01','اضافة فاتورة مبيعات رقم 261','1','0',null,'0','261','sellbillController.php?do=showDetail&sellbillid=261'); -- id=1477
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1477', '465', '1829', '','0'); -- id=1487
UPDATE accountstree SET name = 'محمود شلبي', customName = 'محمود شلبي', customNameEn = 'محمود شلبي', nameEn = 'محمود شلبي', parent = '58', accountNature = '0', theValue = '1829', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 12:12:39' WHERE id = '465';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1477', '143', '1829', '','0'); -- id=1479
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1124204.72', 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 ( '1702', '1702', '2026-10-10', '1', '0', '0', '2026-10-10 09:13:01','اضافة فاتورة مبيعات رقم 261 - صرف البضاعة من المخزن','1','0',null,'0','261','sellbillController.php?do=showDetail&sellbillid=261'); -- id=1478
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1478', '402', '1702', '','0'); -- id=1488
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1009324.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1478', '382', '1702', '','0'); -- id=1480
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2417029.97', 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='1477,0,1478' where sellbillid=261;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 1829, 1704.7, 1702
                    , 1703.4, 1702, 1703.4, 1702
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1703.4, 1703.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1829, sellCostBuyPrice =sellCostBuyPrice+1704.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1702, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1703.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1702, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1703.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1702
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1703.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1703.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 (34, '2026-10-10', 1829, 1704.7, 1702
                    , 1703.4, 1702, 1703.4, 1702
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1703.4, 1703.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1829, sellCostBuyPrice =sellCostBuyPrice+1704.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1702, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1703.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1702, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1703.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1702
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1703.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1703.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, 1829, 1704.7, 1702
                    , 1703.4, 1702, 1703.4, 1702, 1703.4, 1703.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1829, netSellCostBuyPrice = netSellCostBuyPrice+1704.7
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1702
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1703.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1702
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1703.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1702
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1703.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1703.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ac9e4c5cf090 and sellbillId = 261 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 05:43:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:13:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:13:02', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3848
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:22:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:52:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:52:45', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3849
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:22:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:52:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:52:53', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:23:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:53:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:53:00', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=260'); -- id=3851
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:24:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:54:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:54:11', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3852
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 260;
UPDATE sellbill SET  sellbillsysdate = '2026-10-10 09:54:11', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '260';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 17;
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 2160;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,17,0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1241, sellCostBuyPrice =sellCostBuyPrice-1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1169.26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-17
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1241, sellCostBuyPrice =sellCostBuyPrice-1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1169.26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-10 09:54:11' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '17', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '33', '1', '2026-10-10 09:09:52','0','0'); -- id=4035
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 = 2161;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '7', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '22', '1', '2026-10-10 09:09:52','0','0'); -- id=4036
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 53;
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 2162;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-940, sellCostBuyPrice =sellCostBuyPrice-848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-848, sellCostMeanBuyPrice = sellCostMeanBuyPrice-848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-848
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-940, sellCostBuyPrice =sellCostBuyPrice-848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-848, sellCostMeanBuyPrice = sellCostMeanBuyPrice-848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-848
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '4', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '36', '1', '2026-10-10 09:09:52','0','0'); -- id=4037
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 5;
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 2163;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-520, sellCostBuyPrice =sellCostBuyPrice-514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-514, sellCostMeanBuyPrice = sellCostMeanBuyPrice-514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-514
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-520, sellCostBuyPrice =sellCostBuyPrice-514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-514, sellCostMeanBuyPrice = sellCostMeanBuyPrice-514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-514
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '20', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '41', '1', '2026-10-10 09:09:52','0','0'); -- id=4038
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 = 2164;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-10', 2230, 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-2230, sellCostBuyPrice =sellCostBuyPrice-2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 2230, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2230, sellCostBuyPrice =sellCostBuyPrice-2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '37', '38', '1', '2026-10-10 09:09:52','0','0'); -- id=4039
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2165;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '210', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '190', '210', '1', '2026-10-10 09:09:52','0','0'); -- id=4040
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2166;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '323', userid = '1', storedetaildate = '2026-10-10 09:54:12' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '0', '260', 'تعديل فاتورة مبيعات', 'sellbillController.php', '313', '323', '1', '2026-10-10 09:09:52','0','0'); -- id=4041
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '6';
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 ('6','6861.00','6861.00','1','تعديل فاتورة مبيعات','260', '0', '2026-10-10 09:09:52', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '6861', '0', null, '0', null, null,'', '0','1','1','6861','1','2026-10-10 09:09:52','0','0','',''); -- id=435
UPDATE client SET  inUse = 0 where clientid = 6;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6181.5, 6169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6861, sellCostBuyPrice =sellCostBuyPrice-6181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6169.26
                        , returnSellVal = returnSellVal-0, 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 (6, '2026-10-10', 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6181.5, 6169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6861, sellCostBuyPrice =sellCostBuyPrice-6181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6169.26
                        , returnSellVal = returnSellVal-0, 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, 6861, 6181.5, 6181.5
                    , 6169.26, 6181.5, 6169.26, 6181.5, 6181.5, 6169.26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-6861, netSellCostBuyPrice = netSellCostBuyPrice-6181.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-6181.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-6169.26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-6181.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-6169.26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-6181.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-6181.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-6169.26;

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


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

COMMIT;
BEGIN;
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 09:09:52', '06ac9e424487f0', '6', '0.00', '10941', '0', '1', '10941', '10941', '0', '10941', '1', '2026-10-10 09:09:52', '', '1', '0', 'عمرو خطاب ', '1', '1', '3', '0', 'عمرو خطاب ', '399', '260', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-10','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','0',''); -- id=262
UPDATE client SET  clientdebt = '10941', userid = '1' WHERE clientid = '6';
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 ('6','0.00','10941','0','اضافة فاتورة مبيعات (معدله)','262', '10941', '2026-10-10 09:54:13', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '10941', '0', null, '0', null, null,'', '0','1','1','6861','1','2026-10-10 09:09:52','0','0','',''); -- id=436
UPDATE client SET  inUse = 0 where clientid = 6;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '262', '7', '318', '17.00', '73', '1241', '0', '', '0', '2026-10-10 09:54:13', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','17-5,','1','1','0','0','73','1241','0','','0','0.00','0','0','0','0'); -- id=2173
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 2173;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+17
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-10 09:54:14' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '17', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '16', '1', '2026-10-10 09:54:14','0','0'); -- id=4042
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00284', '262', '7', '284', '7.00', '150', '1050', '0', '', '0', '2026-10-10 09:54:14', '284', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','150','1050','0','','0','0.00','0','0','0','0'); -- id=2174
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 = 2174;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-10 09:54:14' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '7', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '22', '15', '1', '2026-10-10 09:54:14','0','0'); -- id=4043
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 53;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('212','00453', '262', '6', '453', '4.00', '235', '940', '0', '', '0', '2026-10-10 09:54:14', '453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','53-4,','1','1','0','0','235','940','0','','0','0.00','0','0','0','0'); -- id=2175
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 2175;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-10 09:54:14' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '4', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '36', '32', '1', '2026-10-10 09:54:14','0','0'); -- id=4044
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25.7','00092', '262', '18', '92', '20.00', '26', '520', '0', '', '0', '2026-10-10 09:54:14', '92', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5-20,','1','1','0','0','26','520','0','','0','0.00','0','0','0','0'); -- id=2176
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 2176;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-10 09:54:15' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '20', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '41', '21', '1', '2026-10-10 09:54:15','0','0'); -- id=4045
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '262', '10', '251', '1.00', '2230', '2230', '0', '', '0', '2026-10-10 09:54:15', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','2230','2230','0','','0','0.00','0','0','0','0'); -- id=2177
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 = 2177;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-10', 2230, 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+2230, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 2230, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2230, 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 = '37', userid = '1', storedetaildate = '2026-10-10 09:54:15' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '38', '37', '1', '2026-10-10 09:54:15','0','0'); -- id=4046
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.25','00240', '262', '2', '240', '20.00', '27', '540', '0', '', '0', '2026-10-10 09:54:15', '240', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','27','540','0','','0','0.00','0','0','0','0'); -- id=2178
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2178;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '190', userid = '1', storedetaildate = '2026-10-10 09:54:15' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '210', '190', '1', '2026-10-10 09:54:15','0','0'); -- id=4047
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '262', '12', '82', '10.00', '34', '340', '0', '', '0', '2026-10-10 09:54:15', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-10,','1','1','0','0','34','340','0','','0','0.00','0','0','0','0'); -- id=2179
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 = 2179;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '313', userid = '1', storedetaildate = '2026-10-10 09:54:16' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '323', '313', '1', '2026-10-10 09:54:16','0','0'); -- id=4048
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '262', '3', '101', '40', '17.75', '710', '0', '', '0', '2026-10-10 09:54:16', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=2180
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 = 2180;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '327', userid = '1', storedetaildate = '2026-10-10 09:54:16' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '367', '327', '1', '2026-10-10 09:54:16','0','0'); -- id=4049
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+40 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '262', '3', '100', '40', '17.75', '710', '0', '', '0', '2026-10-10 09:54:16', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','135-40,','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=2181
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 = 2181;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '315', userid = '1', storedetaildate = '2026-10-10 09:54:16' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '40', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '355', '315', '1', '2026-10-10 09:54:16','0','0'); -- id=4050
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '262', '3', '102', '80', '12', '960', '0', '', '0', '2026-10-10 09:54:16', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','12','960','0','','0','0.00','0','0','0','0'); -- id=2182
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 = 2182;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '712', userid = '1', storedetaildate = '2026-10-10 09:54:17' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '80', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '792', '712', '1', '2026-10-10 09:54:17','0','0'); -- id=4051
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00105', '262', '3', '105', '40', '15.75', '630', '0', '', '0', '2026-10-10 09:54:17', '105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','15.75','630','0','','0','0.00','0','0','0','0'); -- id=2183
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 = 2183;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (105, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '130', userid = '1', storedetaildate = '2026-10-10 09:54:17' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '170', '130', '1', '2026-10-10 09:54:17','0','0'); -- id=4052
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+40 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', '262', '3', '120', '40', '15.75', '630', '0', '', '0', '2026-10-10 09:54:17', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','10-40,','1','1','0','0','15.75','630','0','','0','0.00','0','0','0','0'); -- id=2184
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 = 2184;
 INSERT INTO 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-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '148', userid = '1', storedetaildate = '2026-10-10 09:54:17' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '40', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '188', '148', '1', '2026-10-10 09:54:17','0','0'); -- id=4053
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+80 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', '262', '3', '103', '80', '5.5', '440', '0', '', '0', '2026-10-10 09:54:17', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','8-80,','1','1','0','0','5.5','440','0','','0','0.00','0','0','0','0'); -- id=2185
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 = 2185;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1138', userid = '1', storedetaildate = '2026-10-10 09:54:18' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '80', '1', '262', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1218', '1138', '1', '2026-10-10 09:54:18','0','0'); -- id=4054
UPDATE dailyentry SET totalcreditor = '6861.00', totaldebtor = '6861.00', thedate = '2026-10-10', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-10 09:09:55', entryComment = 'اضافة فاتورة مبيعات رقم 260', fromFlag = '1',related='0',isopeningentry='0',operationId='260',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=260' WHERE id = '1475';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6861.00', '6861.00', '2026-10-10', '1', '0', '1475', '2026-10-10 09:54:18','تم عكس القيد رقم 1475 ','1','0','0','0','0',''); -- id=1479
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1479', '431', '6861.00', '','0'); -- id=1481
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-15 15:37:35' WHERE id = '431';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1479', '143', '6861.00', '','0'); -- id=1489
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1117343.72', 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 = '6181.50', totaldebtor = '6181.50', thedate = '2026-10-10', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-10 09:09:55', entryComment = 'اضافة فاتورة مبيعات رقم 260 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='260',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=260' WHERE id = '1476';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6181.50', '6181.50', '2026-10-10', '1', '0', '1476', '2026-10-10 09:54:18','تم عكس القيد رقم 1476 ','1','0','0','0','0',''); -- id=1480
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1480', '402', '6181.50', '','0'); -- id=1482
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1003142.97', 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 ('1480', '382', '6181.50', '','0'); -- id=1490
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2423211.47', 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 ( '10941', '10941', '2026-10-10', '1', '0', '0', '2026-10-10 09:54:19','اضافة فاتورة مبيعات رقم 262','1','0',null,'0','262','sellbillController.php?do=showDetail&sellbillid=262'); -- id=1481
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1481', '431', '10941', '','0'); -- id=1491
UPDATE accountstree SET name = 'عمرو خطاب ', customName = 'عمرو خطاب ', customNameEn = 'عمرو خطاب ', nameEn = 'عمرو خطاب ', parent = '58', accountNature = '0', theValue = '10941', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 15:37:35' WHERE id = '431';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1481', '143', '10941', '','0'); -- id=1483
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1128284.72', 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 ( '10089.5', '10089.5', '2026-10-10', '1', '0', '0', '2026-10-10 09:54:19','اضافة فاتورة مبيعات رقم 262 - صرف البضاعة من المخزن','1','0',null,'0','262','sellbillController.php?do=showDetail&sellbillid=262'); -- id=1482
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1482', '402', '10089.5', '','0'); -- id=1492
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1013232.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1482', '382', '10089.5', '','0'); -- id=1484
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2413121.97', 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='1481,0,1482' where sellbillid=262;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10941, sellCostBuyPrice =sellCostBuyPrice+10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10077.26
                        , returnSellVal = returnSellVal+0, 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 (6, '2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10941, sellCostBuyPrice =sellCostBuyPrice+10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10077.26
                        , returnSellVal = returnSellVal+0, 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, 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5, 10089.5, 10077.26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10941, netSellCostBuyPrice = netSellCostBuyPrice+10089.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10089.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10077.26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10089.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10077.26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10089.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10089.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10077.26;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 260 and newid=262 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:24:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 09:54:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 09:54:20', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=262'); -- id=3853
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:31:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 10:01:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 10:01:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3854
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:31:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 10:01:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 10:01:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=3855
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:31:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 10:01:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 10:01:40', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=262'); -- id=3856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:32:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 10:02:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 10:02:17', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=3857
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 262;
UPDATE sellbill SET  sellbillsysdate = '2026-10-10 10:02:18', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '262';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 17;
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 2173;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,17,0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1241, sellCostBuyPrice =sellCostBuyPrice-1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1169.26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-17
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1241, sellCostBuyPrice =sellCostBuyPrice-1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1169.26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-10 10:02:18' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '17', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '16', '33', '1', '2026-10-10 09:09:52','0','0'); -- id=4055
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 = 2174;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1050, sellCostBuyPrice =sellCostBuyPrice-805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-805, sellCostMeanBuyPrice = sellCostMeanBuyPrice-805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-805
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2026-10-10 10:02:18' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '7', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '22', '1', '2026-10-10 09:09:52','0','0'); -- id=4056
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 53;
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 2175;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-940, sellCostBuyPrice =sellCostBuyPrice-848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-848, sellCostMeanBuyPrice = sellCostMeanBuyPrice-848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-848
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-940, sellCostBuyPrice =sellCostBuyPrice-848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-848, sellCostMeanBuyPrice = sellCostMeanBuyPrice-848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-848
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-10 10:02:18' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '4', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '32', '36', '1', '2026-10-10 09:09:52','0','0'); -- id=4057
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 5;
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 2176;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-520, sellCostBuyPrice =sellCostBuyPrice-514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-514, sellCostMeanBuyPrice = sellCostMeanBuyPrice-514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-514
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-520, sellCostBuyPrice =sellCostBuyPrice-514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-514, sellCostMeanBuyPrice = sellCostMeanBuyPrice-514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-514
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-10 10:02:18' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '20', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '41', '1', '2026-10-10 09:09:52','0','0'); -- id=4058
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 = 2177;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-10', 2230, 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-2230, sellCostBuyPrice =sellCostBuyPrice-2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 2230, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2230, sellCostBuyPrice =sellCostBuyPrice-2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '37', '38', '1', '2026-10-10 09:09:52','0','0'); -- id=4059
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2178;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '210', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '190', '210', '1', '2026-10-10 09:09:52','0','0'); -- id=4060
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2179;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-340, sellCostBuyPrice =sellCostBuyPrice-308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-308, sellCostMeanBuyPrice = sellCostMeanBuyPrice-308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-308
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '323', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '313', '323', '1', '2026-10-10 09:09:52','0','0'); -- id=4061
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 = 2180;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '367', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '327', '367', '1', '2026-10-10 09:09:52','0','0'); -- id=4062
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-40 where id = 135;
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 = 2181;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-710, sellCostBuyPrice =sellCostBuyPrice-704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-704, sellCostMeanBuyPrice = sellCostMeanBuyPrice-704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-704
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '355', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '40', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '315', '355', '1', '2026-10-10 09:09:52','0','0'); -- id=4063
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 = 2182;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0,80,0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-960, sellCostBuyPrice =sellCostBuyPrice-940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-940, sellCostMeanBuyPrice = sellCostMeanBuyPrice-940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-940
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-80
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-960, sellCostBuyPrice =sellCostBuyPrice-940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-940, sellCostMeanBuyPrice = sellCostMeanBuyPrice-940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-940
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '792', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '80', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '712', '792', '1', '2026-10-10 09:09:52','0','0'); -- id=4064
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 = 2183;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (105, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-630, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-630, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '170', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '130', '170', '1', '2026-10-10 09:09:52','0','0'); -- id=4065
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-40 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 = 2184;
 INSERT INTO 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-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-630, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-630, sellCostBuyPrice =sellCostBuyPrice-600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '188', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '40', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '148', '188', '1', '2026-10-10 09:09:52','0','0'); -- id=4066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-80 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 = 2185;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0,80,0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-440, sellCostBuyPrice =sellCostBuyPrice-360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-80
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-440, sellCostBuyPrice =sellCostBuyPrice-360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-360, sellCostMeanBuyPrice = sellCostMeanBuyPrice-360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-360
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1218', userid = '1', storedetaildate = '2026-10-10 10:02:19' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '80', '0', '262', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1138', '1218', '1', '2026-10-10 09:09:52','0','0'); -- id=4067
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '6';
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 ('6','10941.00','10941.00','1','تعديل فاتورة مبيعات','262', '0', '2026-10-10 09:09:52', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '10941', '0', null, '0', null, null,'', '0','1','1','10941','1','2026-10-10 09:09:52','0','0','',''); -- id=437
UPDATE client SET  inUse = 0 where clientid = 6;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10941, sellCostBuyPrice =sellCostBuyPrice-10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10077.26
                        , returnSellVal = returnSellVal-0, 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 (6, '2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10941, sellCostBuyPrice =sellCostBuyPrice-10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-10077.26
                        , returnSellVal = returnSellVal-0, 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, 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5, 10089.5, 10077.26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-10941, netSellCostBuyPrice = netSellCostBuyPrice-10089.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-10089.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-10077.26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-10089.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-10077.26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-10089.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-10089.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-10077.26;

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


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

COMMIT;
BEGIN;
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 09:09:52', '06ac9e424487f0', '6', '0.00', '10941', '0', '1', '10941', '10941', '0', '10941', '1', '2026-10-10 09:09:52', '', '1', '0', 'عمرو خطاب ', '1', '1', '3', '0', 'عمرو خطاب ', '399', '262', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-10','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','0',''); -- id=263
UPDATE client SET  clientdebt = '10941', userid = '1' WHERE clientid = '6';
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 ('6','0.00','10941','0','اضافة فاتورة مبيعات (معدله)','263', '10941', '2026-10-10 10:02:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '10941', '0', null, '0', null, null,'', '0','1','1','10941','1','2026-10-10 09:09:52','0','0','',''); -- id=438
UPDATE client SET  inUse = 0 where clientid = 6;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '263', '7', '318', '17.00', '73', '1241', '0', '', '0', '2026-10-10 10:02:20', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','17-5,','1','1','0','0','73','1241','0','','0','0.00','0','0','0','0'); -- id=2186
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 2186;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+17
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1241, 1181.5, 1181.5
                    , 1169.26, 1181.5, 1169.26, 1181.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1181.5, 1169.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1241, sellCostBuyPrice =sellCostBuyPrice+1181.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1181.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1169.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1181.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1169.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1181.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1181.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1169.26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-10 10:02:21' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '17', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '16', '1', '2026-10-10 10:02:21','0','0'); -- id=4068
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('115','00284', '263', '7', '284', '7.00', '150', '1050', '0', '', '0', '2026-10-10 10:02:21', '284', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','150','1050','0','','0','0.00','0','0','0','0'); -- id=2187
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 = 2187;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (284, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1050, 805, 805
                    , 805, 805, 805, 805
                    , 0, 0, 0, 0
                    , 0, 0, 0, 805, 805, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+805
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+805, sellCostMeanBuyPrice = sellCostMeanBuyPrice+805
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+805, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+805
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+805
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+805
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+805
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-10 10:02:21' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '7', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '22', '15', '1', '2026-10-10 10:02:21','0','0'); -- id=4069
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 53;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('212','00453', '263', '6', '453', '4.00', '235', '940', '0', '', '0', '2026-10-10 10:02:21', '453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','53-4,','1','1','0','0','235','940','0','','0','0.00','0','0','0','0'); -- id=2188
UPDATE sellbilldetail SET  lastbuyprice = 212.00 , meanbuyprice = 212.00, lastbuyprice_withDiscount = 212.00, meanbuyprice_withDiscount = 212.00
        , lastbuyprice_withTax = 212, meanbuyprice_withTax = 212, lastbuyprice_withDiscountAndTax = 212
                where sellbilldetailid = 2188;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (453, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 940, 848, 848
                    , 848, 848, 848, 848
                    , 0, 0, 0, 0
                    , 0, 0, 0, 848, 848, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+940, sellCostBuyPrice =sellCostBuyPrice+848
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+848, sellCostMeanBuyPrice = sellCostMeanBuyPrice+848
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+848, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+848
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+848
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+848
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+848
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-10 10:02:21' WHERE storedetailid = '453';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('453', '1', '4', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '36', '32', '1', '2026-10-10 10:02:21','0','0'); -- id=4070
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25.7','00092', '263', '18', '92', '20.00', '26', '520', '0', '', '0', '2026-10-10 10:02:22', '92', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5-20,','1','1','0','0','26','520','0','','0','0.00','0','0','0','0'); -- id=2189
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 2189;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 520, 514, 514
                    , 514, 514, 514, 514
                    , 0, 0, 0, 0
                    , 0, 0, 0, 514, 514, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+520, sellCostBuyPrice =sellCostBuyPrice+514
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+514, sellCostMeanBuyPrice = sellCostMeanBuyPrice+514
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+514, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+514
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+514
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+514
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+514
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-10 10:02:22' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '20', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '41', '21', '1', '2026-10-10 10:02:22','0','0'); -- id=4071
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '263', '10', '251', '1.00', '2230', '2230', '0', '', '0', '2026-10-10 10:02:22', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','2230','2230','0','','0','0.00','0','0','0','0'); -- id=2190
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 = 2190;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-10', 2230, 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+2230, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 2230, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2230, 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 = '37', userid = '1', storedetaildate = '2026-10-10 10:02:22' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '38', '37', '1', '2026-10-10 10:02:22','0','0'); -- id=4072
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.25','00240', '263', '2', '240', '20.00', '27', '540', '0', '', '0', '2026-10-10 10:02:22', '240', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','27','540','0','','0','0.00','0','0','0','0'); -- id=2191
UPDATE sellbilldetail SET  lastbuyprice = 26.25 , meanbuyprice = 26.25, lastbuyprice_withDiscount = 26.25, meanbuyprice_withDiscount = 26.25
        , lastbuyprice_withTax = 26.25, meanbuyprice_withTax = 26.25, lastbuyprice_withDiscountAndTax = 26.25
                where sellbilldetailid = 2191;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (240, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 540, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '190', userid = '1', storedetaildate = '2026-10-10 10:02:22' WHERE storedetailid = '240';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('240', '1', '20', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '210', '190', '1', '2026-10-10 10:02:23','0','0'); -- id=4073
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '263', '12', '82', '10.00', '34', '340', '0', '', '0', '2026-10-10 10:02:23', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-10,','1','1','0','0','34','340','0','','0','0.00','0','0','0','0'); -- id=2192
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 = 2192;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '313', userid = '1', storedetaildate = '2026-10-10 10:02:23' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '323', '313', '1', '2026-10-10 10:02:23','0','0'); -- id=4074
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '263', '3', '101', '40.00', '17.75', '710', '0', '', '0', '2026-10-10 10:02:23', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=2193
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 = 2193;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '327', userid = '1', storedetaildate = '2026-10-10 10:02:23' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '40', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '367', '327', '1', '2026-10-10 10:02:23','0','0'); -- id=4075
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+40 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '263', '3', '100', '40.00', '17.75', '710', '0', '', '0', '2026-10-10 10:02:23', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','135-40,','1','1','0','0','17.75','710','0','','0','0.00','0','0','0','0'); -- id=2194
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 = 2194;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 710, 704, 704
                    , 704, 704, 704, 704
                    , 0, 0, 0, 0
                    , 0, 0, 0, 704, 704, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+710, sellCostBuyPrice =sellCostBuyPrice+704
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+704, sellCostMeanBuyPrice = sellCostMeanBuyPrice+704
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+704, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+704
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+704
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+704
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+704
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '315', userid = '1', storedetaildate = '2026-10-10 10:02:24' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '40', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '355', '315', '1', '2026-10-10 10:02:24','0','0'); -- id=4076
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '263', '3', '102', '80.00', '12', '960', '0', '', '0', '2026-10-10 10:02:24', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','12','960','0','','0','0.00','0','0','0','0'); -- id=2195
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 = 2195;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 960, 940, 940
                    , 940, 940, 940, 940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 940, 940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '712', userid = '1', storedetaildate = '2026-10-10 10:02:24' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '80', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '792', '712', '1', '2026-10-10 10:02:24','0','0'); -- id=4077
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00105', '263', '3', '105', '40.00', '15.75', '630', '0', '', '0', '2026-10-10 10:02:24', '105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','15.75','630','0','','0','0.00','0','0','0','0'); -- id=2196
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 = 2196;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (105, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '130', userid = '1', storedetaildate = '2026-10-10 10:02:24' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '40', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '170', '130', '1', '2026-10-10 10:02:24','0','0'); -- id=4078
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+80 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', '263', '3', '103', '80.00', '5.5', '440', '0', '', '0', '2026-10-10 10:02:24', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','8-80,','1','1','0','0','5.5','440','0','','0','0.00','0','0','0','0'); -- id=2197
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 = 2197;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+80
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 440, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1138', userid = '1', storedetaildate = '2026-10-10 10:02:25' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '80', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1218', '1138', '1', '2026-10-10 10:02:25','0','0'); -- id=4079
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00106', '263', '3', '106', '40', '15.75', '630', '0', '', '0', '2026-10-10 10:02:25', '106', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','15.75','630','0','','0','0.00','0','0','0','0'); -- id=2198
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 = 2198;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (106, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 630, 600, 600
                    , 600, 600, 600, 600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 600, 600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+630, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '396', userid = '1', storedetaildate = '2026-10-10 10:02:25' WHERE storedetailid = '106';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('106', '1', '40', '1', '263', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '436', '396', '1', '2026-10-10 10:02:25','0','0'); -- id=4080
UPDATE dailyentry SET totalcreditor = '10941.00', totaldebtor = '10941.00', thedate = '2026-10-10', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-10 09:54:19', entryComment = 'اضافة فاتورة مبيعات رقم 262', fromFlag = '1',related='0',isopeningentry='0',operationId='262',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=262' WHERE id = '1481';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10941.00', '10941.00', '2026-10-10', '1', '0', '1481', '2026-10-10 10:02:25','تم عكس القيد رقم 1481 ','1','0','0','0','0',''); -- id=1483
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1483', '431', '10941.00', '','0'); -- id=1485
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-15 15:37:35' WHERE id = '431';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1483', '143', '10941.00', '','0'); -- id=1493
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1117343.72', 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 = '10089.50', totaldebtor = '10089.50', thedate = '2026-10-10', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-10 09:54:19', entryComment = 'اضافة فاتورة مبيعات رقم 262 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='262',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=262' WHERE id = '1482';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10089.50', '10089.50', '2026-10-10', '1', '0', '1482', '2026-10-10 10:02:26','تم عكس القيد رقم 1482 ','1','0','0','0','0',''); -- id=1484
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1484', '402', '10089.50', '','0'); -- id=1486
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1003142.97', 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 ('1484', '382', '10089.50', '','0'); -- id=1494
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2423211.47', 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 ( '10941', '10941', '2026-10-10', '1', '0', '0', '2026-10-10 10:02:26','اضافة فاتورة مبيعات رقم 263','1','0',null,'0','263','sellbillController.php?do=showDetail&sellbillid=263'); -- id=1485
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1485', '431', '10941', '','0'); -- id=1495
UPDATE accountstree SET name = 'عمرو خطاب ', customName = 'عمرو خطاب ', customNameEn = 'عمرو خطاب ', nameEn = 'عمرو خطاب ', parent = '58', accountNature = '0', theValue = '10941', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 15:37:35' WHERE id = '431';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1485', '143', '10941', '','0'); -- id=1487
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1128284.72', 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 ( '10089.5', '10089.5', '2026-10-10', '1', '0', '0', '2026-10-10 10:02:26','اضافة فاتورة مبيعات رقم 263 - صرف البضاعة من المخزن','1','0',null,'0','263','sellbillController.php?do=showDetail&sellbillid=263'); -- id=1486
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1486', '402', '10089.5', '','0'); -- id=1496
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1013232.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1486', '382', '10089.5', '','0'); -- id=1488
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2413121.97', 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='1485,0,1486' where sellbillid=263;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10941, sellCostBuyPrice =sellCostBuyPrice+10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10077.26
                        , returnSellVal = returnSellVal+0, 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 (6, '2026-10-10', 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10089.5, 10077.26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10941, sellCostBuyPrice =sellCostBuyPrice+10089.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10089.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10077.26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10089.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10077.26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10089.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10089.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10077.26
                        , returnSellVal = returnSellVal+0, 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, 10941, 10089.5, 10089.5
                    , 10077.26, 10089.5, 10077.26, 10089.5, 10089.5, 10077.26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10941, netSellCostBuyPrice = netSellCostBuyPrice+10089.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10089.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10077.26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10089.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10077.26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10089.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10089.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10077.26;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 262 and newid=263 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 06:32:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 10:02:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 10:02:27', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=263'); -- id=3858
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:41:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:11:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreportbills.php', '2026-10-10 11:11:28', '1', 'showbills', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/salesreportbills.php?do=showbills'); -- id=3859
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:42:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:12:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:12:10', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=225'); -- id=3860
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:42:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:12:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:12:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3861
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:43:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:13:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-10 11:14:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3862
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:44:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:14:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-10 11:14:13', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=3863
UPDATE productunit SET proUnitSellAllPrice  = 44 * productnumber  WHERE productid = 83;
UPDATE product SET productName = 'لفه سوسته 16 ملي رصاصي', productDescription = '', productCatId = '12', productBuyPrice = '39.60', productSellAllPrice = '44', productSellUnitPrice = '45.00', productSellHalfPrice = '45.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '40', parcode = '00083',type ='0', expireDate = '0' , dailyentryId = '99',isService = '0',isOptic = '0',lastbuyprice = '39.60',lastbuyprice_withDiscount = '39.6',meanbuyprice = '40.90',meanbuyprice_withDiscount = '40.9' , productbuypricereal = '42.30' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.38' , buyhalf_precentage = '6.38' , buypart_precentage = '6.38',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39.6',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='39.6',meanbuyprice_withTax='40.9',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='39.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '83';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (83, 1,'2026-10-10 11:14:34',1)
                ON DUPLICATE KEY UPDATE productid = 83, edited = 1, sysdate = '2026-10-10 11:14:34', userid = 1; -- id=87
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:44:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:14:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:14:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3864
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:55:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:25:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:25:23', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=3865
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:55:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:25:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:25:44', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=3866

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =439
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(6,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-10 11:25:44', userid = '1' WHERE clientid = '6';
UPDATE client SET  inUse = 0 where clientid = 6;
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 ('6','10941.00','10941','1','ايصال تحصيل (( قبض من عميل ))','439', '0', '2026-10-10 11:25:23', '1', 'clientPayedDeptController.php', '   ', '10941', '0', null, '0', null, null,'', '-1','1','1','10941','1','','42','0','','.'); -- id=439
UPDATE save SET  savecurrentvalue = '-847948.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-858889.80','10941', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '439', '-847948.8', '2026-10-10 11:25:45', '1',  'clientPayedDeptController.php','6','','0'); -- id=275
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10941', '10941', '2026-10-10', '1', '0', '0', '2026-10-10 11:25:45','اضافة ايصال سداد للعميل عمرو خطاب ','1','0','0','0','439','clientPayedDeptController.php?do=show&id=439'); -- id=1487
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1487', '383', '10941', '','0'); -- id=1497
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-68160.7', 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 ('1487', '431', '10941', '','0'); -- id=1489
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-15 15:37:35' WHERE id = '431';
UPDATE clientdebtchange SET clientid = '6', clientdebtchangebefore = '10941.000', clientdebtchangeamount = '10941.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '439', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-10 11:25:23', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '10941.000',discount='', reciptid='0', dailyentryid = '1487',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='10941',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '439';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:55:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:25:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:25:46', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=3867
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:55:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:25:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:25:48', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=3868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:55:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:25:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:25:50', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=3869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:56:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:26:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:26:07', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=3870

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =440
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(34,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-10 11:26:08', userid = '1' WHERE clientid = '34';
UPDATE client SET  inUse = 0 where clientid = 34;
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 ('34','1829.00','1829','1','ايصال تحصيل (( قبض من عميل ))','440', '0', '2026-10-10 11:25:50', '1', 'clientPayedDeptController.php', '   ', '1829', '0', null, '0', null, null,'', '-1','1','1','1829','1','','43','0','','.'); -- id=440
UPDATE save SET  savecurrentvalue = '-846119.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-847948.80','1829', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '440', '-846119.8', '2026-10-10 11:26:08', '1',  'clientPayedDeptController.php','34','','0'); -- id=276
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1829', '1829', '2026-10-10', '1', '0', '0', '2026-10-10 11:26:08','اضافة ايصال سداد للعميل محمود شلبي','1','0','0','0','440','clientPayedDeptController.php?do=show&id=440'); -- id=1488
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1488', '383', '1829', '','0'); -- id=1498
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-66331.7', 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 ('1488', '465', '1829', '','0'); -- id=1490
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-23 12:12:39' WHERE id = '465';
UPDATE clientdebtchange SET clientid = '34', clientdebtchangebefore = '1829.000', clientdebtchangeamount = '1829.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '440', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-10 11:25:50', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '1829.000',discount='', reciptid='0', dailyentryid = '1488',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1829',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '440';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:56:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:26:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:26:09', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=3871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 07:56:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:26:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 11:26:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=3872
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:25:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:55:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:55:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3873
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:26:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:56:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:56:39', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3874

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aca0b96953b8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 11:56:40', '06aca0b96953b8', '1', '0.00', '0', '0', '1', '3050.00', '3050', '3050', '0', '1', '2026-10-10 11:56:40', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','3050','0','','0','0','3050','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=264
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','اضافة فاتورة مبيعات','264', '0', '2026-10-10 11:56:41', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3050', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-10 11:56:40','0','0','',''); -- id=441
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 2;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2891','00039', '264', '1', '39', '1', '3050', '3050', '0', '', '1', '2026-10-10 11:56:41', '39', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','2-1,','1','1','0','0','3050','3050','0','','0','0.00','0','0','0','0'); -- id=2199
UPDATE sellbilldetail SET  lastbuyprice = 2891.00 , meanbuyprice = 2891.00, lastbuyprice_withDiscount = 2891.00, meanbuyprice_withDiscount = 2891.00
        , lastbuyprice_withTax = 2891, meanbuyprice_withTax = 2891, lastbuyprice_withDiscountAndTax = 2891
                where sellbilldetailid = 2199;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (39, '2026-10-10', 3050, 2891, 2891
                    , 2891, 2891, 2891, 2891
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2891, 2891, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2891
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2891, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2891
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2891, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2891
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2891
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2891
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2891
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 3050, 2891, 2891
                    , 2891, 2891, 2891, 2891
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2891, 2891, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2891
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2891, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2891
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2891, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2891
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2891
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2891
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2891
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-10 11:56:41' WHERE storedetailid = '39';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('39', '1', '1', '1', '264', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-10 11:56:41','0','0'); -- id=4081
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-843069.8125',  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 ('-846119.8125','3050', '0', '1', 'اضافة فاتورة مبيعات', '264', '-843069.8125', '2026-10-10 11:56:41', '1',  'sellbillController.php','1','','0'); -- id=277
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3050', '3050', '2026-10-10', '1', '0', '0', '2026-10-10 11:56:41','اضافة فاتورة مبيعات رقم 264','1','0',null,'0','264','sellbillController.php?do=showDetail&sellbillid=264'); -- id=1489
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1489', '383', '3050', '','0'); -- id=1499
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-63281.7', 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 ('1489', '143', '3050', '','0'); -- id=1491
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1131334.72', 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 ( '2891', '2891', '2026-10-10', '1', '0', '0', '2026-10-10 11:56:41','اضافة فاتورة مبيعات رقم 264 - صرف البضاعة من المخزن','1','0',null,'0','264','sellbillController.php?do=showDetail&sellbillid=264'); -- id=1490
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1490', '402', '2891', '','0'); -- id=1500
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1016123.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1490', '382', '2891', '','0'); -- id=1492
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2410230.97', 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='1489,0,1490' where sellbillid=264;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 3050, 2891, 2891
                    , 2891, 2891, 2891, 2891
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2891, 2891, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2891
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2891, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2891
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2891, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2891
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2891
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2891
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2891
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 3050, 2891, 2891
                    , 2891, 2891, 2891, 2891
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2891, 2891, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3050, sellCostBuyPrice =sellCostBuyPrice+2891
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2891, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2891
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2891, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2891
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2891
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2891
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2891
                        , returnSellVal = returnSellVal+0, 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, 3050, 2891, 2891
                    , 2891, 2891, 2891, 2891, 2891, 2891)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3050, netSellCostBuyPrice = netSellCostBuyPrice+2891
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2891
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2891
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2891
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2891
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2891
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2891
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2891;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aca0b96953b8 and sellbillId = 264 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:26:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 11:56:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 11:56:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3875
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:34:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:04:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-10 12:04:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=3876
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:35:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:05:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-10 12:05:15', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=3877
UPDATE storedetail SET  productquantity = '420', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '385';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '1', '415', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '5', '420', '1', '2026-10-10','0','0'); -- id=4082
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3527.5', '3527.5', '2026-10-10', '1', '0', '0', '2026-10-10 12:05:16','اعادة جرد للمنتج : (علبه ماجيك مجوز احمد ومحمود/خراطيم) فى مخزن : (المخزن الرئيسي) بالكمية : 420','1','0',null,'0','4082','inventoryController.php?do=details&id=4082'); -- id=1491
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1491', '382', '3527.5', '','0'); -- id=1501
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2413758.47', 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 ('1491', '188', '3527.5', '','0'); -- id=1493
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-65193.4', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:35:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:05:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 12:05:21', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:36:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:06:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 12:06:39', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3879

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aca0de240034
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 12:06:39', '06aca0de240034', '1', '0.00', '0', '0', '1', '1576.50', '1576.5', '1576.5', '0', '1', '2026-10-10 12:06:39', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '120' ,'0','','','','','-1','0','0','0','0','0','1576','0','','0','0','1576.5','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=265
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','اضافة فاتورة مبيعات','265', '0', '2026-10-10 12:06:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1576.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-10 12:06:39','0','0','',''); -- id=442
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.5','00385', '265', '12', '385', '30', '9.8', '294', '0', '', '1', '2026-10-10 12:06:40', '385', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9.8','294','0','','0','0.00','0','0','0','0'); -- id=2200
UPDATE sellbilldetail SET  lastbuyprice = 8.50 , meanbuyprice = 8.50, lastbuyprice_withDiscount = 8.50, meanbuyprice_withDiscount = 8.50
        , lastbuyprice_withTax = 8.5, meanbuyprice_withTax = 8.5, lastbuyprice_withDiscountAndTax = 8.5
                where sellbilldetailid = 2200;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (385, '2026-10-10', 294, 255, 255
                    , 255, 255, 255, 255
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 255, 255, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+294, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+255
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+255
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+255
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 294, 255, 255
                    , 255, 255, 255, 255
                    , 0, 0, 0, 0
                    , 0, 0, 0, 255, 255, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+294, sellCostBuyPrice =sellCostBuyPrice+255
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+255, sellCostMeanBuyPrice = sellCostMeanBuyPrice+255
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+255, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+255
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+255
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+255
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+255
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '390', userid = '1', storedetaildate = '2026-10-10 12:06:40' WHERE storedetailid = '385';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '1', '30', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '420', '390', '1', '2026-10-10 12:06:40','0','0'); -- id=4083
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 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', '265', '20', '388', '50', '5.25', '262.5', '0', '', '1', '2026-10-10 12:06:40', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-50,','1','1','0','0','5.25','262.5','0','','0','0.00','0','0','0','0'); -- id=2201
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 = 2201;
 INSERT INTO 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-10-10', 262.5, 241, 241
                    , 241, 241, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 241, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+262.5, sellCostBuyPrice =sellCostBuyPrice+241
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+241
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 262.5, 241, 241
                    , 241, 241, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0, 241, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+262.5, sellCostBuyPrice =sellCostBuyPrice+241
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+241
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1123', userid = '1', storedetaildate = '2026-10-10 12:06:41' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '50', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1173', '1123', '1', '2026-10-10 12:06:41','0','0'); -- id=4084
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '265', '12', '83', '10', '45', '450', '0', '', '1', '2026-10-10 12:06:41', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-10,','1','1','0','0','45','450','0','','0','0.00','0','0','0','0'); -- id=2202
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2202;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-10', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 450, 396, 396
                    , 409, 396, 409, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 409, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+409
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+409
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+409
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '265', userid = '1', storedetaildate = '2026-10-10 12:06:41' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '10', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '275', '265', '1', '2026-10-10 12:06:41','0','0'); -- id=4085
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '265', '14', '81', '30', '19', '570', '0', '', '1', '2026-10-10 12:06:41', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','570','0','','0','0.00','0','0','0','0'); -- id=2203
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 = 2203;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-10', 570, 540, 540
                    , 540, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 540, 540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 570, 540, 540
                    , 540, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 540, 540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+570, sellCostBuyPrice =sellCostBuyPrice+540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '142', userid = '1', storedetaildate = '2026-10-10 12:06:41' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '30', '1', '265', 'اضافة فاتورة مبيعات', 'sellbillController.php', '172', '142', '1', '2026-10-10 12:06:41','0','0'); -- id=4086
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-841493.3125',  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 ('-843069.8125','1576.5', '0', '1', 'اضافة فاتورة مبيعات', '265', '-841493.3125', '2026-10-10 12:06:41', '1',  'sellbillController.php','1','','0'); -- id=278
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1576.5', '1576.5', '2026-10-10', '1', '0', '0', '2026-10-10 12:06:42','اضافة فاتورة مبيعات رقم 265','1','0',null,'0','265','sellbillController.php?do=showDetail&sellbillid=265'); -- id=1492
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1492', '383', '1576.5', '','0'); -- id=1502
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-61705.2', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1492', '143', '1576.5', '','0'); -- id=1494
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1132911.22', 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 ( '1432', '1432', '2026-10-10', '1', '0', '0', '2026-10-10 12:06:42','اضافة فاتورة مبيعات رقم 265 - صرف البضاعة من المخزن','1','0',null,'0','265','sellbillController.php?do=showDetail&sellbillid=265'); -- id=1493
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1493', '402', '1432', '','0'); -- id=1503
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1017555.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1493', '382', '1432', '','0'); -- id=1495
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2412326.47', 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='1492,0,1493' where sellbillid=265;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 1576.5, 1432, 1432
                    , 1445, 1432, 1445, 1432
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1432, 1445, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1576.5, sellCostBuyPrice =sellCostBuyPrice+1432
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1432, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1445
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1432, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1445
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1432
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1432
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1445
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 1576.5, 1432, 1432
                    , 1445, 1432, 1445, 1432
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1432, 1445, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1576.5, sellCostBuyPrice =sellCostBuyPrice+1432
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1432, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1445
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1432, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1445
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1432
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1432
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1445
                        , returnSellVal = returnSellVal+0, 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, 1576.5, 1432, 1432
                    , 1445, 1432, 1445, 1432, 1432, 1445)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1576.5, netSellCostBuyPrice = netSellCostBuyPrice+1432
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1432
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1445
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1432
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1445
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1432
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1432
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1445;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aca0de240034 and sellbillId = 265 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:36:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:06:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 12:06:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:36:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:06:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 12:06:49', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3881
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:37:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:07:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-10 12:07:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:37:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:07:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-10 12:07:51', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=3883
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 ('علبه ماجيك مجوز شاشه احمد ومحمود','','12','10.6','11','11.5','11','2026-10-10','0','1','0','','0','0','0','0','0','10.6','10.6','10.6','10.6','10.6','0','3.77','3.77','8.49','.','0','0','0','10.6','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','10.6','10.6','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','10.6','0','0','0','0','0','0','','','0','0','0','0'); -- id=585
UPDATE product SET productName = 'علبه ماجيك مجوز شاشه احمد ومحمود', productDescription = '', productCatId = '12', productBuyPrice = '10.6', productSellAllPrice = '11', productSellUnitPrice = '11.5', productSellHalfPrice = '11', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '0', parcode = '00585',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10.6',lastbuyprice_withDiscount = '10.6',meanbuyprice = '10.6',meanbuyprice_withDiscount = '10.6' , productbuypricereal = '10.6' , buypricereal_precentage = '0' , buytotal_precentage = '3.77' , buyhalf_precentage = '3.77' , buypart_precentage = '8.49',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='10.6',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='10.6',meanbuyprice_withTax='10.6',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='10.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '585';
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', '585', '1.00', '2026-10-10', '1', '0','0058501','11','11','11.5','10.6','','0','0','0','0','0','0','0','0','0','0'); -- id=585
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('585', '1', '150', '1', '2026-10-10'); -- id=585
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '1', '150', '0', '585', 'إضافة منتج', 'productController.php', '0', '150', '1', '2026-10-10','0','0'); -- id=4087
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (585, 1,'2026-10-10 12:07:53',1)
                ON DUPLICATE KEY UPDATE productid = 585, edited = 1, sysdate = '2026-10-10 12:07:53', userid = 1; -- id=745
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1590', '1590', '2026-10-10', '1', '0', '0', '2026-10-10 12:07:53','إضافة منتج علبه ماجيك مجوز شاشه احمد ومحمود الكمية 150','1','0','0','0','585','productController.php?do=edit&id=585'); -- id=1494
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1494', '382', '1590', '','0'); -- id=1504
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2413916.47', 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 ('1494', '121', '1590', '','0'); -- id=1496
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1740486.77', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'علبه ماجيك مجوز شاشه احمد ومحمود', productDescription = '', productCatId = '12', productBuyPrice = '10.60', productSellAllPrice = '11.00', productSellUnitPrice = '11.50', productSellHalfPrice = '11.00', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '0', parcode = '00585',type ='0', expireDate = '0' , dailyentryId = '1494',isService = '0',isOptic = '0',lastbuyprice = '10.6',lastbuyprice_withDiscount = '10.6',meanbuyprice = '10.6',meanbuyprice_withDiscount = '10.6' , productbuypricereal = '10.6' , buypricereal_precentage = '0' , buytotal_precentage = '3.77' , buyhalf_precentage = '3.77' , buypart_precentage = '8.49',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='10.6',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='10.6',meanbuyprice_withTax='10.6',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='10.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '585';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 08:37:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 12:07:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-10 12:07:55', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=3884
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 10:04:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 13:34:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 13:34:00', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 13:16:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 16:46:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-10 16:46:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=3886
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 13:16:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 16:46:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-10 16:46:27', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=3887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 13:16:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 16:46:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 16:46:33', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=257'); -- id=3888
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 13:16:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 16:46:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 16:46:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:13:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 18:43:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 18:43:55', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3890

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aca4fde87011
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(24,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 18:43:59', '06aca4fde87011', '24', '2521.00', '4036', '0', '1', '1515.00', '1515', '0', '1515', '1', '2026-10-10 18:43:59', '', '1', '0', 'وليد الهنداوي', '1', '1', '3', '0', '24 - وليد الهنداوي', '22' ,'0','','','','','-1','0','0','0','0','0','1515','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=266
UPDATE client SET  clientdebt = '4036', userid = '1' WHERE clientid = '24';
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 ('24','2521.00','1515','0','اضافة فاتورة مبيعات','266', '4036', '2026-10-10 18:43:59', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1515', '0', null, '0', null, null,'', '0','1','1','1515','1','2026-10-10 18:43:59','0','0','',''); -- id=443
UPDATE client SET  inUse = 0 where clientid = 24;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('735','00209', '266', '10', '209', '1', '745', '745', '0', '', '0', '2026-10-10 18:44:00', '209', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','143-1,','1','1','0','0','745','745','0','','0','0.00','0','0','0','0'); -- id=2204
UPDATE sellbilldetail SET  lastbuyprice = 735.00 , meanbuyprice = 735.00, lastbuyprice_withDiscount = 735.00, meanbuyprice_withDiscount = 735.00
        , lastbuyprice_withTax = 735, meanbuyprice_withTax = 735, lastbuyprice_withDiscountAndTax = 735
                where sellbilldetailid = 2204;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (209, '2026-10-10', 745, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+745, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 745, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+745, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-10 18:44:00' WHERE storedetailid = '209';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '1', '1', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '7', '1', '2026-10-10 18:44:00','0','0'); -- id=4088
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 141;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('385','00267', '266', '10', '267', '1', '400', '400', '0', '', '0', '2026-10-10 18:44:00', '267', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','141-1,','1','1','0','0','400','400','0','','0','0.00','0','0','0','0'); -- id=2205
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where sellbilldetailid = 2205;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (267, '2026-10-10', 400, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 400, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-10 18:44:00' WHERE storedetailid = '267';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '1', '1', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '7', '1', '2026-10-10 18:44:00','0','0'); -- id=4089
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '266', '14', '81', '20', '18.5', '370', '0', '', '0', '2026-10-10 18:44:00', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','370','0','','0','0.00','0','0','0','0'); -- id=2206
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 = 2206;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-10', 370, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+370, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 370, 360, 360
                    , 360, 360, 360, 360
                    , 0, 0, 0, 0
                    , 0, 0, 0, 360, 360, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+370, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+360
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+360
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+360
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '122', userid = '1', storedetaildate = '2026-10-10 18:44:01' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '20', '1', '266', 'اضافة فاتورة مبيعات', 'sellbillController.php', '142', '122', '1', '2026-10-10 18:44:01','0','0'); -- id=4090
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1515', '1515', '2026-10-10', '1', '0', '0', '2026-10-10 18:44:01','اضافة فاتورة مبيعات رقم 266','1','0',null,'0','266','sellbillController.php?do=showDetail&sellbillid=266'); -- id=1495
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1495', '453', '1515', '','0'); -- id=1505
UPDATE accountstree SET name = 'وليد الهنداوي', customName = 'وليد الهنداوي', customNameEn = 'وليد الهنداوي', nameEn = 'وليد الهنداوي', parent = '58', accountNature = '0', theValue = '4036', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-21 21:39:30' WHERE id = '453';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1495', '143', '1515', '','0'); -- id=1497
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1134426.22', 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 ( '1480', '1480', '2026-10-10', '1', '0', '0', '2026-10-10 18:44:01','اضافة فاتورة مبيعات رقم 266 - صرف البضاعة من المخزن','1','0',null,'0','266','sellbillController.php?do=showDetail&sellbillid=266'); -- id=1496
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1496', '402', '1480', '','0'); -- id=1506
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1019035.47', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1496', '382', '1480', '','0'); -- id=1498
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2412436.47', 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='1495,0,1496' where sellbillid=266;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 1515, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1515, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, 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 (24, '2026-10-10', 1515, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1515, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, 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, 1515, 1480, 1480
                    , 1480, 1480, 1480, 1480, 1480, 1480)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1515, netSellCostBuyPrice = netSellCostBuyPrice+1480
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1480
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1480
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1480
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1480
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1480
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1480
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1480;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aca4fde87011 and sellbillId = 266 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:14:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 18:44:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 18:44:03', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3891
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:35:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 19:05:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-10 19:05:00', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=3892
UPDATE productunit SET unitid = '1', productid = '296', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0029601',proUnitSellAllPrice='8.5',proUnitSellHalfPrice='8.5',proUnitSellUnitPrice ='9',proUnitBuyPrice='7.5',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '296';
UPDATE product SET productName = 'علبه خارج هيرو ', productDescription = '', productCatId = '6', productBuyPrice = '7.28', productSellAllPrice = '8.5', productSellUnitPrice = '9', productSellHalfPrice = '8.5', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00296',type ='0', expireDate = '0' , dailyentryId = '347',isService = '0',isOptic = '0',lastbuyprice = '7.50',lastbuyprice_withDiscount = '7.5',meanbuyprice = '7.50',meanbuyprice_withDiscount = '7.5' , productbuypricereal = '7.5' , buypricereal_precentage = '0' , buytotal_precentage = '13.33' , buyhalf_precentage = '13.33' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7.5',meanbuyprice_withTax='7.5',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='7.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '296';
UPDATE productunit SET unitid = '1', productid = '291', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0029101',proUnitSellAllPrice='25.8',proUnitSellHalfPrice='25.8',proUnitSellUnitPrice ='28',proUnitBuyPrice='24.8',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '291';
UPDATE product SET productName = 'فيشه دكر ', productDescription = '', productCatId = '24', productBuyPrice = '25.6', productSellAllPrice = '26.5', productSellUnitPrice = '28', productSellHalfPrice = '26.5', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00291',type ='0', expireDate = '0' , dailyentryId = '342',isService = '0',isOptic = '0',lastbuyprice = '24.80',lastbuyprice_withDiscount = '24.8',meanbuyprice = '24.80',meanbuyprice_withDiscount = '24.8' , productbuypricereal = '24.8' , buypricereal_precentage = '0' , buytotal_precentage = '4.03' , buyhalf_precentage = '4.03' , buypart_precentage = '12.9',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='24.8',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='24.8',meanbuyprice_withTax='24.8',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.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '291';
UPDATE productunit SET unitid = '1', productid = '292', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0029201',proUnitSellAllPrice='26.8',proUnitSellHalfPrice='26.8',proUnitSellUnitPrice ='30',proUnitBuyPrice='25.8',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '292';
UPDATE product SET productName = 'فيشه نتايه ', productDescription = '', productCatId = '24', productBuyPrice = '26.96', productSellAllPrice = '27.5', productSellUnitPrice = '30', productSellHalfPrice = '27.5', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00292',type ='0', expireDate = '0' , dailyentryId = '343',isService = '0',isOptic = '0',lastbuyprice = '25.80',lastbuyprice_withDiscount = '25.8',meanbuyprice = '25.80',meanbuyprice_withDiscount = '25.8' , productbuypricereal = '25.8' , buypricereal_precentage = '0' , buytotal_precentage = '3.88' , buyhalf_precentage = '3.88' , buypart_precentage = '16.28',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='25.8',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='25.8',meanbuyprice_withTax='25.8',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='25.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '292';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('عود داكت 1.5 ','','6','12.25','14','15','14','2026-10-10','0','1','1','','0','0','0','0','0','12.25','12.25','12.25','12.25','12.25','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','12.25','12.25','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=586
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (586, 1,'2026-10-10 19:07:31',1)
                ON DUPLICATE KEY UPDATE productid = 586, edited = 1, sysdate = '2026-10-10 19:07:31', userid = 1; -- id=746
UPDATE product SET productName = 'عود داكت 1.5 ', productDescription = '', productCatId = '6', productBuyPrice = '12.25', productSellAllPrice = '14', productSellUnitPrice = '15', productSellHalfPrice = '14', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '1', parcode = '00586',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '12.25',lastbuyprice_withDiscount = '12.25',meanbuyprice = '12.25',meanbuyprice_withDiscount = '12.25' , productbuypricereal = '12.25' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='12.25',meanbuyprice_withTax='12.25',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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '586';
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', '586', '1', '2026-10-10', '1', '0','0058601','14','14','15','12.25','','0','0','0','0','0','0','0','0','0','0'); -- id=586
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('586', '1', '0', '1', '2026-10-10'); -- id=586
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '1', '0', '0', '586', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-10','0','0'); -- id=4091
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.25','23','25','23','2026-10-10','0','1','1','','0','0','0','0','0','21.25','21.25','21.25','21.25','21.25','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','21.25','21.25','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=587
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (587, 1,'2026-10-10 19:08:04',1)
                ON DUPLICATE KEY UPDATE productid = 587, edited = 1, sysdate = '2026-10-10 19:08:04', userid = 1; -- id=747
UPDATE product SET productName = 'عود داكت 2.5 ', productDescription = '', productCatId = '6', productBuyPrice = '21.25', productSellAllPrice = '23', productSellUnitPrice = '25', productSellHalfPrice = '23', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '1', parcode = '00587',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '21.25',lastbuyprice_withDiscount = '21.25',meanbuyprice = '21.25',meanbuyprice_withDiscount = '21.25' , productbuypricereal = '21.25' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21.25',meanbuyprice_withTax='21.25',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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '587';
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', '587', '1', '2026-10-10', '1', '0','0058701','23','23','25','21.25','','0','0','0','0','0','0','0','0','0','0'); -- id=587
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('587', '1', '0', '1', '2026-10-10'); -- id=587
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '1', '0', '0', '587', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-10','0','0'); -- id=4092
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:38:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 19:08:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-10 19:08:51', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=3893
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06aca704583ae7', '2026-10-10 19:05:09', '1', '81528.92', '81528.92', '0', '0', '5214.65',  '5214.65', '5214.6500', '0', '1', '2026-10-10 19:08:51', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=49
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00296', '49', '6', '296', '190', '7.28', '1383.20', '0', '', '2026-10-10 19:08:51', '296','','','0','0','0','0','0',null,'7.28','1383.2','0','0','0','0','0','0','0','0','1'); -- id=181
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-10 19:05:09', 1, 296, 0, 0
                    , 7.28, 190, 0, 0, 1, '2026-10-10 19:08:52')
                ON DUPLICATE KEY UPDATE buyprice = 7.28,
                        buyQuantity =buyQuantity+190, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-10 19:08:52' ; -- id=181
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('296', '7.28', '190', '0', 'buyBillController.php', '181', '', '0', '0'); -- id=181
UPDATE product SET  productBuyPrice = "7.28" WHERE productId = 296 ;
UPDATE buybilldetail SET  quantitybefore = 20 WHERE buybilldetailid = 181 ;
UPDATE product SET productName = 'علبه خارج هيرو ', productDescription = '', productCatId = '6', productBuyPrice = '7.28', productSellAllPrice = '8.50', productSellUnitPrice = '9.00', productSellHalfPrice = '8.50', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00296',type ='0', expireDate = '0' , dailyentryId = '347',isService = '0',isOptic = '0',lastbuyprice = '7.28',lastbuyprice_withDiscount = '7.28',meanbuyprice = '7.3',meanbuyprice_withDiscount = '7.3' , productbuypricereal = '7.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '13.33' , buyhalf_precentage = '13.33' , buypart_precentage = '20.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='7.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='7.28',meanbuyprice_withTax='7.3',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='7.28',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '296';
UPDATE buybilldetail SET  lastbuyprice = 7.28 , meanbuyprice = 7.3, lastbuyprice_withDiscount = 7.28, meanbuyprice_withDiscount = 7.3
        , lastbuyprice_withTax = 7.28, meanbuyprice_withTax = 7.3, lastbuyprice_withDiscountAndTax = 7.28
                where buybilldetailid = 181;
UPDATE productunit SET proUnitBuyPrice  = 7.28 * productnumber WHERE productid = 296;
UPDATE storedetail SET  productquantity = '210', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '190', '0', '49', 'اضافة فاتورة مشتريات', 'buyBillController.php', '20', '210', '1', '2026-10-10 19:05:09','0','0'); -- id=4093
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00291', '49', '24', '291', '60', '25.6', '1536.00', '0', '', '2026-10-10 19:08:51', '291','','','0','0','0','0','0',null,'25.6','1536','0','0','0','0','0','0','0','0','1'); -- id=182
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-10 19:05:09', 1, 291, 0, 0
                    , 25.6, 60, 0, 0, 1, '2026-10-10 19:08:53')
                ON DUPLICATE KEY UPDATE buyprice = 25.6,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-10 19:08:53' ; -- id=182
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('291', '25.6', '60', '0', 'buyBillController.php', '182', '', '0', '0'); -- id=182
UPDATE product SET  productBuyPrice = "25.6" WHERE productId = 291 ;
UPDATE buybilldetail SET  quantitybefore = 56 WHERE buybilldetailid = 182 ;
UPDATE product SET productName = 'فيشه دكر ', productDescription = '', productCatId = '24', productBuyPrice = '25.60', productSellAllPrice = '26.50', productSellUnitPrice = '28.00', productSellHalfPrice = '26.50', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00291',type ='0', expireDate = '0' , dailyentryId = '342',isService = '0',isOptic = '0',lastbuyprice = '25.6',lastbuyprice_withDiscount = '25.6',meanbuyprice = '25.21',meanbuyprice_withDiscount = '25.21' , productbuypricereal = '24.80' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.03' , buyhalf_precentage = '4.03' , buypart_precentage = '12.90',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='24.8',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='25.6',meanbuyprice_withTax='25.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='25.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '291';
UPDATE buybilldetail SET  lastbuyprice = 25.6 , meanbuyprice = 25.21, lastbuyprice_withDiscount = 25.6, meanbuyprice_withDiscount = 25.21
        , lastbuyprice_withTax = 25.6, meanbuyprice_withTax = 25.21, lastbuyprice_withDiscountAndTax = 25.6
                where buybilldetailid = 182;
UPDATE productunit SET proUnitBuyPrice  = 25.6 * productnumber WHERE productid = 291;
UPDATE storedetail SET  productquantity = '116', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '60', '0', '49', 'اضافة فاتورة مشتريات', 'buyBillController.php', '56', '116', '1', '2026-10-10 19:05:09','0','0'); -- id=4094
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00292', '49', '24', '292', '20', '26.96', '539.20', '0', '', '2026-10-10 19:08:51', '292','','','0','0','0','0','0',null,'26.96','539.2','0','0','0','0','0','0','0','0','1'); -- id=183
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-10 19:05:09', 1, 292, 0, 0
                    , 26.96, 20, 0, 0, 1, '2026-10-10 19:08:53')
                ON DUPLICATE KEY UPDATE buyprice = 26.96,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-10 19:08:53' ; -- id=183
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('292', '26.96', '20', '0', 'buyBillController.php', '183', '', '0', '0'); -- id=183
UPDATE product SET  productBuyPrice = "26.96" WHERE productId = 292 ;
UPDATE buybilldetail SET  quantitybefore = 15 WHERE buybilldetailid = 183 ;
UPDATE product SET productName = 'فيشه نتايه ', productDescription = '', productCatId = '24', productBuyPrice = '26.96', productSellAllPrice = '27.50', productSellUnitPrice = '30.00', productSellHalfPrice = '27.50', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00292',type ='0', expireDate = '0' , dailyentryId = '343',isService = '0',isOptic = '0',lastbuyprice = '26.96',lastbuyprice_withDiscount = '26.96',meanbuyprice = '26.46',meanbuyprice_withDiscount = '26.46' , productbuypricereal = '25.80' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.88' , buyhalf_precentage = '3.88' , buypart_precentage = '16.28',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='25.8',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='26.96',meanbuyprice_withTax='26.46',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='26.96',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '292';
UPDATE buybilldetail SET  lastbuyprice = 26.96 , meanbuyprice = 26.46, lastbuyprice_withDiscount = 26.96, meanbuyprice_withDiscount = 26.46
        , lastbuyprice_withTax = 26.96, meanbuyprice_withTax = 26.46, lastbuyprice_withDiscountAndTax = 26.96
                where buybilldetailid = 183;
UPDATE productunit SET proUnitBuyPrice  = 26.96 * productnumber WHERE productid = 292;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '292';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '1', '20', '0', '49', 'اضافة فاتورة مشتريات', 'buyBillController.php', '15', '35', '1', '2026-10-10 19:05:09','0','0'); -- id=4095
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00586', '49', '6', '586', '100', '12.25', '1225.00', '0', '', '2026-10-10 19:08:51', '586','','','0','0','0','0','0',null,'12.25','1225','0','0','0','0','0','0','0','0','1'); -- id=184
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-10 19:05:09', 1, 586, 0, 0
                    , 12.25, 100, 0, 0, 1, '2026-10-10 19:08:54')
                ON DUPLICATE KEY UPDATE buyprice = 12.25,
                        buyQuantity =buyQuantity+100, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-10 19:08:54' ; -- id=184
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('586', '12.25', '100', '0', 'buyBillController.php', '184', '', '0', '0'); -- id=184
UPDATE product SET  productBuyPrice = "12.25" WHERE productId = 586 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 184 ;
UPDATE product SET productName = 'عود داكت 1.5 ', productDescription = '', productCatId = '6', productBuyPrice = '12.25', productSellAllPrice = '14.00', productSellUnitPrice = '15.00', productSellHalfPrice = '14.00', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '1', parcode = '00586',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '12.25',lastbuyprice_withDiscount = '12.25',meanbuyprice = '12.25',meanbuyprice_withDiscount = '12.25' , productbuypricereal = '12.25' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='12.25',meanbuyprice_withTax='12.25',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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='12.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 = '586';
UPDATE buybilldetail SET  lastbuyprice = 12.25 , meanbuyprice = 12.25, lastbuyprice_withDiscount = 12.25, meanbuyprice_withDiscount = 12.25
        , lastbuyprice_withTax = 12.25, meanbuyprice_withTax = 12.25, lastbuyprice_withDiscountAndTax = 12.25
                where buybilldetailid = 184;
UPDATE productunit SET proUnitBuyPrice  = 12.25 * productnumber WHERE productid = 586;
UPDATE storedetail SET  productquantity = '100', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '586';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('586', '1', '100', '0', '49', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '100', '1', '2026-10-10 19:05:09','0','0'); -- id=4096
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00587', '49', '6', '587', '25', '21.25', '531.25', '0', '', '2026-10-10 19:08:51', '587','','','0','0','0','0','0',null,'21.25','531.25','0','0','0','0','0','0','0','0','1'); -- id=185
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-10 19:05:09', 1, 587, 0, 0
                    , 21.25, 25, 0, 0, 1, '2026-10-10 19:08:55')
                ON DUPLICATE KEY UPDATE buyprice = 21.25,
                        buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-10 19:08:55' ; -- id=185
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('587', '21.25', '25', '0', 'buyBillController.php', '185', '', '0', '0'); -- id=185
UPDATE product SET  productBuyPrice = "21.25" WHERE productId = 587 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 185 ;
UPDATE product SET productName = 'عود داكت 2.5 ', productDescription = '', productCatId = '6', productBuyPrice = '21.25', productSellAllPrice = '23.00', productSellUnitPrice = '25.00', productSellHalfPrice = '23.00', productDate = '2026-10-10', conditions = '0', userId = '1', limitamount = '1', parcode = '00587',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '21.25',lastbuyprice_withDiscount = '21.25',meanbuyprice = '21.25',meanbuyprice_withDiscount = '21.25' , productbuypricereal = '21.25' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='21.25',meanbuyprice_withTax='21.25',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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='21.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 = '587';
UPDATE buybilldetail SET  lastbuyprice = 21.25 , meanbuyprice = 21.25, lastbuyprice_withDiscount = 21.25, meanbuyprice_withDiscount = 21.25
        , lastbuyprice_withTax = 21.25, meanbuyprice_withTax = 21.25, lastbuyprice_withDiscountAndTax = 21.25
                where buybilldetailid = 185;
UPDATE productunit SET proUnitBuyPrice  = 21.25 * productnumber WHERE productid = 587;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-10' WHERE storedetailid = '587';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('587', '1', '25', '0', '49', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '25', '1', '2026-10-10 19:05:09','0','0'); -- id=4097
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-10 19:08:51'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '81528.92', '0', '0', 'اضافة فاتورة مشتريات', '49', '81528.92', '2026-10-10 19:05:09', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=87
UPDATE save SET  savecurrentvalue = '-846707.96',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-841493.31','5214.65', '1', '1', 'اضافة فاتورة مشتريات', '49', '-846707.96', '2026-10-10 19:05:09', '1',  'buyBillController.php','0','','0'); -- id=279
update buybill set dailyentryid='0,0' where buybillid=49;
COMMIT;
UPDATE product SET overAllAveragePrice = 25.14 WHERE productId = 291;UPDATE product SET overAllAveragePrice = 26.96 WHERE productId = 292;UPDATE product SET overAllAveragePrice = 7.28 WHERE productId = 296;UPDATE product SET overAllAveragePrice = 12.25 WHERE productId = 586;UPDATE product SET overAllAveragePrice = 21.25 WHERE productId = 587;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:38:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 19:08:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-10 19:08:57', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=49'); -- id=3894
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:39:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 19:09:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 19:09:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 15:41:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 19:11:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 19:11:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 16:44:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:14:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-10 20:14:39', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=3897
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 16:44:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:14:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-10 20:14:51', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=3898
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 16:45:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:15:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 20:15:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 17:12:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:42:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 20:42:24', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=3900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 17:13:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:43:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-10 20:43:10', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=3901

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aca87110d55f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 20:43:11', '06aca87110d55f', '1', '0.00', '0', '0', '1', '545.75', '545.75', '545.75', '0', '1', '2026-10-10 20:43:11', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '19' ,'0','','','','','-1','0','0','0','0','0','545','0','','0','0','545.75','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=267
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','اضافة فاتورة مبيعات','267', '0', '2026-10-10 20:43:12', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '545.75', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-10 20:43:11','0','0','',''); -- id=444
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '267', '12', '82', '1', '34', '34', '0', '', '1', '2026-10-10 20:43:12', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-1,','1','1','0','0','34','34','0','','0','0.00','0','0','0','0'); -- id=2207
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 = 2207;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-10', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 34, 30.8, 30.8
                    , 30.8, 30.8, 30.8, 30.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30.8, 30.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34, sellCostBuyPrice =sellCostBuyPrice+30.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '312', userid = '1', storedetaildate = '2026-10-10 20:43:12' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '1', '1', '267', 'اضافة فاتورة مبيعات', 'sellbillController.php', '313', '312', '1', '2026-10-10 20:43:12','0','0'); -- id=4098
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 102;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('348','00070', '267', '12', '70', '1', '380', '380', '0', '', '1', '2026-10-10 20:43:12', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','102-1,','1','1','0','0','380','380','0','','0','0.00','0','0','0','0'); -- id=2208
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 2208;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (70, '2026-10-10', 380, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+380, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+332.81
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 380, 348, 348
                    , 332.81, 348, 332.81, 340
                    , 0, 0, 0, 0
                    , 0, 0, 0, 348, 332.81, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+380, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+332.81
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+332.81
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+340
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+332.81
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74', userid = '1', storedetaildate = '2026-10-10 20:43:12' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '1', '1', '267', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '74', '1', '2026-10-10 20:43:12','0','0'); -- id=4099
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '267', '12', '86', '15', '6.25', '93.75', '0', '', '1', '2026-10-10 20:43:13', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.25','93.75','0','','0','0.00','0','0','0','0'); -- id=2209
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2209;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-10', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93.75, sellCostBuyPrice =sellCostBuyPrice+88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88.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+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93.75, sellCostBuyPrice =sellCostBuyPrice+88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88.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 = '420', userid = '1', storedetaildate = '2026-10-10 20:43:13' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '15', '1', '267', 'اضافة فاتورة مبيعات', 'sellbillController.php', '435', '420', '1', '2026-10-10 20:43:13','0','0'); -- id=4100
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '267', '14', '81', '2', '19', '38', '0', '', '1', '2026-10-10 20:43:13', '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=2210
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 = 2210;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-10', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 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 = '120', userid = '1', storedetaildate = '2026-10-10 20:43:13' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '267', 'اضافة فاتورة مبيعات', 'sellbillController.php', '122', '120', '1', '2026-10-10 20:43:13','0','0'); -- id=4101
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-846162.1875',  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 ('-846707.9375','545.75', '0', '1', 'اضافة فاتورة مبيعات', '267', '-846162.1875', '2026-10-10 20:43:13', '1',  'sellbillController.php','1','','0'); -- id=280
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '545.75', '545.75', '2026-10-10', '1', '0', '0', '2026-10-10 20:43:14','اضافة فاتورة مبيعات رقم 267','1','0',null,'0','267','sellbillController.php?do=showDetail&sellbillid=267'); -- id=1497
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1497', '383', '545.75', '','0'); -- id=1507
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-61159.45', 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 ('1497', '143', '545.75', '','0'); -- id=1499
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1134971.97', 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 ( '503.3', '503.3', '2026-10-10', '1', '0', '0', '2026-10-10 20:43:14','اضافة فاتورة مبيعات رقم 267 - صرف البضاعة من المخزن','1','0',null,'0','267','sellbillController.php?do=showDetail&sellbillid=267'); -- id=1498
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1498', '402', '503.3', '','0'); -- id=1508
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1019538.77', 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 ('1498', '382', '503.3', '','0'); -- id=1500
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2411933.17', 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='1497,0,1498' where sellbillid=267;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 545.75, 503.3, 503.3
                    , 488.11, 503.3, 488.11, 495.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,503.3, 488.11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545.75, sellCostBuyPrice =sellCostBuyPrice+503.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+503.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+488.11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+503.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+488.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+495.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+503.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+488.11
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 545.75, 503.3, 503.3
                    , 488.11, 503.3, 488.11, 495.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,503.3, 488.11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545.75, sellCostBuyPrice =sellCostBuyPrice+503.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+503.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+488.11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+503.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+488.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+495.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+503.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+488.11
                        , returnSellVal = returnSellVal+0, 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, 545.75, 503.3, 503.3
                    , 488.11, 503.3, 488.11, 495.3, 503.3, 488.11)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+545.75, netSellCostBuyPrice = netSellCostBuyPrice+503.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+503.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+488.11
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+503.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+488.11
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+495.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+503.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+488.11;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aca87110d55f and sellbillId = 267 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aca87443e57c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(4,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-10 20:55:39', '06aca87443e57c', '4', '-126.32', '1441.18', '0', '1', '1567.50', '1567.5', '0', '1567.5', '1', '2026-10-10 20:55:39', '', '1', '0', 'محمد عبدالله الالفي', '1', '1', '3', '0', 'محمد عبدالله الالفي', '56' ,'0','','','','','-1','0','0','0','0','0','1567','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-10','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=268
UPDATE client SET  clientdebt = '1441.18', userid = '1' WHERE clientid = '4';
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 ('4','-126.32','1567.5','0','اضافة فاتورة مبيعات','268', '1441.18', '2026-10-10 20:55:39', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1567.5', '0', null, '0', null, null,'', '0','1','1','1567.5','1','2026-10-10 20:55:39','0','0','',''); -- id=445
UPDATE client SET  inUse = 0 where clientid = 4;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 163;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '268', '1', '5', '50', '10.65', '532.5', '0', '', '0', '2026-10-10 20:55:40', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','163-50,','1','1','0','0','10.65','532.5','0','','0','','0','0','0','0'); -- id=2211
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 2211;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-10', 532.5, 527.5, 527.5
                    , 527.5, 527.5, 527.5, 527.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 527.5, 527.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+527.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+527.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+527.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+527.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+527.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+527.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+527.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+527.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 532.5, 527.5, 527.5
                    , 527.5, 527.5, 527.5, 527.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 527.5, 527.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+527.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+527.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+527.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+527.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+527.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+527.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+527.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+527.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 = '6222', userid = '1', storedetaildate = '2026-10-10 20:55:40' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '50', '1', '268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6272', '6222', '1', '2026-10-10 20:55:40','0','0'); -- id=4102
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 149;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '268', '1', '10', '3', '239', '717', '0', '', '0', '2026-10-10 20:55:40', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','149-3,','1','1','0','0','239','717','0','','0','0.00','0','0','0','0'); -- id=2212
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 = 2212;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-10-10', 717, 711, 711
                    , 711, 711, 711, 711
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 711, 711, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+717, sellCostBuyPrice =sellCostBuyPrice+711
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+711, sellCostMeanBuyPrice = sellCostMeanBuyPrice+711
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+711, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+711
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+711
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+711
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+711
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 717, 711, 711
                    , 711, 711, 711, 711
                    , 0, 0, 0, 0
                    , 0, 0, 0, 711, 711, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+717, sellCostBuyPrice =sellCostBuyPrice+711
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+711, sellCostMeanBuyPrice = sellCostMeanBuyPrice+711
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+711, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+711
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+711
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+711
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+711
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-10-10 20:55:40' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '3', '1', '268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '224', '221', '1', '2026-10-10 20:55:40','0','0'); -- id=4103
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 161;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '268', '1', '6', '3', '106', '318', '0', '', '0', '2026-10-10 20:55:40', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','161-3,','1','1','0','0','106','318','0','','0','0.00','0','0','0','0'); -- id=2213
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 = 2213;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-10-10', 318, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+318, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-10', 318, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+318, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '291', userid = '1', storedetaildate = '2026-10-10 20:55:41' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '3', '1', '268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '294', '291', '1', '2026-10-10 20:55:41','0','0'); -- id=4104
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1567.5', '1567.5', '2026-10-10', '1', '0', '0', '2026-10-10 20:55:41','اضافة فاتورة مبيعات رقم 268','1','0',null,'0','268','sellbillController.php?do=showDetail&sellbillid=268'); -- id=1499
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1499', '428', '1567.5', '','0'); -- id=1509
UPDATE accountstree SET name = 'محمد عبدالله الالفي', customName = 'محمد عبدالله الالفي', customNameEn = 'محمد عبدالله الالفي', nameEn = 'محمد عبدالله الالفي', parent = '58', accountNature = '0', theValue = '1441.18', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 09:05:36' WHERE id = '428';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1499', '143', '1567.5', '','0'); -- id=1501
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1136539.47', 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 ( '1553.5', '1553.5', '2026-10-10', '1', '0', '0', '2026-10-10 20:55:41','اضافة فاتورة مبيعات رقم 268 - صرف البضاعة من المخزن','1','0',null,'0','268','sellbillController.php?do=showDetail&sellbillid=268'); -- id=1500
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1500', '402', '1553.5', '','0'); -- id=1510
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1021092.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 dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1500', '382', '1553.5', '','0'); -- id=1502
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2410379.67', 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='1499,0,1500' where sellbillid=268;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-10', 1567.5, 1553.5, 1553.5
                    , 1553.5, 1553.5, 1553.5, 1553.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1553.5, 1553.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1567.5, sellCostBuyPrice =sellCostBuyPrice+1553.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1553.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1553.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1553.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1553.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1553.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1553.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1553.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-10', 1567.5, 1553.5, 1553.5
                    , 1553.5, 1553.5, 1553.5, 1553.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1553.5, 1553.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1567.5, sellCostBuyPrice =sellCostBuyPrice+1553.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1553.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1553.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1553.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1553.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1553.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1553.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1553.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1567.5, 1553.5, 1553.5
                    , 1553.5, 1553.5, 1553.5, 1553.5, 1553.5, 1553.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1567.5, netSellCostBuyPrice = netSellCostBuyPrice+1553.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1553.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1553.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1553.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1553.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1553.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1553.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1553.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aca87443e57c and sellbillId = 268 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =446
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(4,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-558.82' , clientdate = '2026-10-10 20:56:04', userid = '1' WHERE clientid = '4';
UPDATE client SET  inUse = 0 where clientid = 4;
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 ('4','1441.18','2000','1','ايصال تحصيل (( قبض من عميل ))','446', '-558.82', '2026-10-10 20:55:52', '1', 'clientPayedDeptController.php', '   ', '2000', '0', null, '0', null, null,'', '-1','1','1','2000','1','','44','0','','.'); -- id=446
UPDATE save SET  savecurrentvalue = '-844162.19',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-846162.19','2000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '446', '-844162.19', '2026-10-10 20:56:04', '1',  'clientPayedDeptController.php','4','','0'); -- id=281
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2000', '2000', '2026-10-10', '1', '0', '0', '2026-10-10 20:56:04','اضافة ايصال سداد للعميل محمد عبدالله الالفي','1','0','0','0','446','clientPayedDeptController.php?do=show&id=446'); -- id=1501
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1501', '383', '2000', '','0'); -- id=1511
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-59159.45', 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 ('1501', '428', '2000', '','0'); -- id=1503
UPDATE accountstree SET name = 'محمد عبدالله الالفي', customName = 'محمد عبدالله الالفي', customNameEn = 'محمد عبدالله الالفي', nameEn = 'محمد عبدالله الالفي', parent = '58', accountNature = '0', theValue = '-558.82', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 09:05:36' WHERE id = '428';
UPDATE clientdebtchange SET clientid = '4', clientdebtchangebefore = '1441.180', clientdebtchangeamount = '2000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '446', clientdebtchangeafter = '-558.820', clientdebtchangedate = '2026-10-10 20:55:52', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2000.000',discount='', reciptid='0', dailyentryid = '1501',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='2000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '446';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 17:26:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:56:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 20:56:05', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=3907
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-10 17:26:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-10 20:56:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-10 20:56:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=3908
