UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 05:51:44";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 05:51:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:21:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-21 09:21:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=4766
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-21',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-21 05:51:54";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-21 09:21:55', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=4767
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:00:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:30:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:30:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:04:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:34:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:34:02', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4769

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad86a1f58f4e
-- ----------------------------------------------------------------------------------------------------

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-21 09:34:02', '06ad86a1f58f4e', '1', '0.00', '0', '0', '1', '10252.85', '10252.85', '10252.85', '0', '1', '2026-10-21 09:34:02', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '250' ,'0','','','','','-1','0','0','0','0','0','10252','0','','0','0','10252.85','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-21','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=361
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','اضافة فاتورة مبيعات','361', '0', '2026-10-21 09:34:03', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10252.85', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-21 09:34:02','0','0','',''); -- id=615
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+58 where id = 120;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '361', '1', '41', '58', '46', '2668', '0', '', '1', '2026-10-21 09:34:03', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','120-58,','1','1','0','0','46','2668','0','','0','0.00','0','0','0','0'); -- id=2863
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 2863;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-10-21', 2668, 2571.14, 2571.14
                    , 2571.14, 2571.14, 2571.14, 2571.14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 58, 0, 2571.14, 2571.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2668, sellCostBuyPrice =sellCostBuyPrice+2571.14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2571.14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2571.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2571.14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2571.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2571.14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2571.14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2571.14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+58
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 2668, 2571.14, 2571.14
                    , 2571.14, 2571.14, 2571.14, 2571.14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2571.14, 2571.14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2668, sellCostBuyPrice =sellCostBuyPrice+2571.14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2571.14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2571.14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2571.14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2571.14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2571.14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2571.14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2571.14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1026', userid = '1', storedetaildate = '2026-10-21 09:34:03' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '58', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1084', '1026', '1', '2026-10-21 09:34:03','0','0'); -- id=5065
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+50 where id = 127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '361', '1', '43', '50', '30.75', '1537.5', '0', '', '1', '2026-10-21 09:34:03', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','127-50,','1','1','0','0','30.75','1537.5','0','','0','0.00','0','0','0','0'); -- id=2864
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2864;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-10-21', 1537.5, 1475, 1475
                    , 1475, 1475, 1475, 1475
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 1475, 1475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1537.5, sellCostBuyPrice =sellCostBuyPrice+1475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1475
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1475
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1537.5, 1475, 1475
                    , 1475, 1475, 1475, 1475
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1475, 1475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1537.5, sellCostBuyPrice =sellCostBuyPrice+1475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1475
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1475
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1027', userid = '1', storedetaildate = '2026-10-21 09:34:04' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '50', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1077', '1027', '1', '2026-10-21 09:34:04','0','0'); -- id=5066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+37 where id = 121;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '361', '1', '42', '37', '30.75', '1137.75', '0', '', '1', '2026-10-21 09:34:04', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','121-37,','1','1','0','0','30.75','1137.75','0','','0','0.00','0','0','0','0'); -- id=2865
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 2865;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-10-21', 1137.75, 1091.5, 1091.5
                    , 1091.5, 1091.5, 1091.5, 1091.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 37, 0, 1091.5, 1091.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1137.75, sellCostBuyPrice =sellCostBuyPrice+1091.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1091.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1091.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1091.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1091.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1091.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1091.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1091.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+37
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 1137.75, 1091.5, 1091.5
                    , 1091.5, 1091.5, 1091.5, 1091.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1091.5, 1091.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1137.75, sellCostBuyPrice =sellCostBuyPrice+1091.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1091.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1091.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1091.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1091.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1091.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1091.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1091.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 = '1088', userid = '1', storedetaildate = '2026-10-21 09:34:04' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '37', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1125', '1088', '1', '2026-10-21 09:34:04','0','0'); -- id=5067
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('84.4','00056', '361', '1', '56', '1', '88.5', '88.5', '0', '', '1', '2026-10-21 09:34:04', '56', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','88.5','88.5','0','','0','0.00','0','0','0','0'); -- id=2866
UPDATE sellbilldetail SET  lastbuyprice = 84.40 , meanbuyprice = 84.40, lastbuyprice_withDiscount = 84.40, meanbuyprice_withDiscount = 84.40
        , lastbuyprice_withTax = 84.4, meanbuyprice_withTax = 84.4, lastbuyprice_withDiscountAndTax = 84.4
                where sellbilldetailid = 2866;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (56, '2026-10-21', 88.5, 84.4, 84.4
                    , 84.4, 84.4, 84.4, 84.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 84.4, 84.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+88.5, sellCostBuyPrice =sellCostBuyPrice+84.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 88.5, 84.4, 84.4
                    , 84.4, 84.4, 84.4, 84.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 84.4, 84.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+88.5, sellCostBuyPrice =sellCostBuyPrice+84.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-10-21 09:34:04' WHERE storedetailid = '56';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('56', '1', '1', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '17', '1', '2026-10-21 09:34:04','0','0'); -- id=5068
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 227;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.5','00297', '361', '6', '297', '1', '40', '40', '0', '', '1', '2026-10-21 09:34:04', '297', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','227-1,','1','1','0','0','40','40','0','','0','0.00','0','0','0','0'); -- id=2867
UPDATE sellbilldetail SET  lastbuyprice = 34.50 , meanbuyprice = 34.56, lastbuyprice_withDiscount = 34.50, meanbuyprice_withDiscount = 34.56
        , lastbuyprice_withTax = 34.5, meanbuyprice_withTax = 34.56, lastbuyprice_withDiscountAndTax = 34.5
                where sellbilldetailid = 2867;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (297, '2026-10-21', 40, 34.5, 34.5
                    , 34.56, 34.5, 34.56, 34.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 34.5, 34.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+34.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-21', 40, 34.5, 34.5
                    , 34.56, 34.5, 34.56, 34.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 34.5, 34.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+34.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-21 09:34:05' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '1', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '56', '1', '2026-10-21 09:34:05','0','0'); -- id=5069
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 156;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '361', '1', '9', '6', '319', '1914', '0', '', '1', '2026-10-21 09:34:05', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','156-6,','1','1','0','0','319','1914','0','','0','0.00','0','0','0','0'); -- id=2868
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 2868;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-21', 1914, 1836, 1836
                    , 1836, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1836, 1836, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1914, sellCostBuyPrice =sellCostBuyPrice+1836
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1836, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1836
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1836
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1836
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 1914, 1836, 1836
                    , 1836, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1836, 1836, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1914, sellCostBuyPrice =sellCostBuyPrice+1836
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1836, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1836
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1836
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1836
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '195', userid = '1', storedetaildate = '2026-10-21 09:34:05' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '6', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '201', '195', '1', '2026-10-21 09:34:05','0','0'); -- id=5070
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('129.7','00059', '361', '1', '59', '3', '136', '408', '0', '', '1', '2026-10-21 09:34:05', '59', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','408','0','','0','0.00','0','0','0','0'); -- id=2869
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 2869;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (59, '2026-10-21', 408, 389.1, 389.1
                    , 389.1, 389.1, 389.1, 389.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 389.1, 389.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+408, sellCostBuyPrice =sellCostBuyPrice+389.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+389.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+389.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+389.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+389.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+389.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+389.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+389.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 408, 389.1, 389.1
                    , 389.1, 389.1, 389.1, 389.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 389.1, 389.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+408, sellCostBuyPrice =sellCostBuyPrice+389.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+389.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+389.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+389.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+389.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+389.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+389.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+389.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '164', userid = '1', storedetaildate = '2026-10-21 09:34:05' WHERE storedetailid = '59';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '1', '3', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '167', '164', '1', '2026-10-21 09:34:05','0','0'); -- id=5071
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('129.7','00062', '361', '1', '62', '3', '136', '408', '0', '', '1', '2026-10-21 09:34:06', '62', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','408','0','','0','0.00','0','0','0','0'); -- id=2870
UPDATE sellbilldetail SET  lastbuyprice = 129.70 , meanbuyprice = 129.70, lastbuyprice_withDiscount = 129.70, meanbuyprice_withDiscount = 129.70
        , lastbuyprice_withTax = 129.7, meanbuyprice_withTax = 129.7, lastbuyprice_withDiscountAndTax = 129.7
                where sellbilldetailid = 2870;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (62, '2026-10-21', 408, 389.1, 389.1
                    , 389.1, 389.1, 389.1, 389.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 389.1, 389.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+408, sellCostBuyPrice =sellCostBuyPrice+389.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+389.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+389.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+389.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+389.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+389.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+389.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+389.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 408, 389.1, 389.1
                    , 389.1, 389.1, 389.1, 389.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 389.1, 389.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+408, sellCostBuyPrice =sellCostBuyPrice+389.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+389.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+389.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+389.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+389.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+389.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+389.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+389.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-10-21 09:34:06' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '3', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '13', '1', '2026-10-21 09:34:06','0','0'); -- id=5072
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 146;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237.5','00045', '361', '1', '45', '3', '246.5', '739.5', '0', '', '1', '2026-10-21 09:34:06', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','146-3,','1','1','0','0','246.5','739.5','0','','0','0.00','0','0','0','0'); -- id=2871
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 2871;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-10-21', 739.5, 712.5, 712.5
                    , 712.5, 712.5, 712.5, 712.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 712.5, 712.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+739.5, sellCostBuyPrice =sellCostBuyPrice+712.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+712.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+712.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+712.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+712.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+712.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+712.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+712.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 739.5, 712.5, 712.5
                    , 712.5, 712.5, 712.5, 712.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 712.5, 712.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+739.5, sellCostBuyPrice =sellCostBuyPrice+712.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+712.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+712.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+712.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+712.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+712.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+712.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+712.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 = '109', userid = '1', storedetaildate = '2026-10-21 09:34:06' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '3', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '109', '1', '2026-10-21 09:34:06','0','0'); -- id=5073
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 124;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00046', '361', '1', '46', '2', '95', '190', '0', '', '1', '2026-10-21 09:34:06', '46', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','124-2,','1','1','0','0','95','190','0','','0','0.00','0','0','0','0'); -- id=2872
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2872;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 190, 179.4, 179.4
                    , 179.4, 179.4, 179.4, 179.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 179.4, 179.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+179.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+179.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+179.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+179.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+179.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+179.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+179.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+179.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 179.4, 179.4
                    , 179.4, 179.4, 179.4, 179.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 179.4, 179.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+179.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+179.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+179.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+179.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+179.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+179.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+179.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+179.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 = '103', userid = '1', storedetaildate = '2026-10-21 09:34:07' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '2', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105', '103', '1', '2026-10-21 09:34:07','0','0'); -- id=5074
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 125;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '361', '1', '47', '2', '95', '190', '0', '', '1', '2026-10-21 09:34:07', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','125-2,','1','1','0','0','95','190','0','','0','0.00','0','0','0','0'); -- id=2873
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 2873;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-21', 190, 179.4, 179.4
                    , 179.4, 179.4, 179.4, 179.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 179.4, 179.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+179.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+179.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+179.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+179.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+179.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+179.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+179.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+179.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 179.4, 179.4
                    , 179.4, 179.4, 179.4, 179.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 179.4, 179.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+179.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+179.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+179.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+179.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+179.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+179.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+179.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+179.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 = '129', userid = '1', storedetaildate = '2026-10-21 09:34:07' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '2', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '131', '129', '1', '2026-10-21 09:34:07','0','0'); -- id=5075
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('100.3','00049', '361', '1', '49', '2', '105', '210', '0', '', '1', '2026-10-21 09:34:07', '49', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','105','210','0','','0','0.00','0','0','0','0'); -- id=2874
UPDATE sellbilldetail SET  lastbuyprice = 100.30 , meanbuyprice = 100.30, lastbuyprice_withDiscount = 100.30, meanbuyprice_withDiscount = 100.30
        , lastbuyprice_withTax = 100.3, meanbuyprice_withTax = 100.3, lastbuyprice_withDiscountAndTax = 100.3
                where sellbilldetailid = 2874;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (49, '2026-10-21', 210, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 210, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-6', userid = '1', storedetaildate = '2026-10-21 09:34:07' WHERE storedetailid = '49';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '1', '2', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '-4', '-6', '1', '2026-10-21 09:34:07','0','0'); -- id=5076
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+82 where id = 128;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.44','00044', '361', '1', '44', '82', '8.8', '721.6', '0', '', '1', '2026-10-21 09:34:07', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','128-82,','1','1','0','0','8.8','721.6','0','','0','0.00','0','0','0','0'); -- id=2875
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 2875;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-10-21', 721.6, 692.08, 692.08
                    , 692.08, 692.08, 692.08, 692.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 82, 0, 692.08, 692.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+721.6, sellCostBuyPrice =sellCostBuyPrice+692.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+692.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+692.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+692.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+692.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+692.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+692.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+692.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+82
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 721.6, 692.08, 692.08
                    , 692.08, 692.08, 692.08, 692.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 692.08, 692.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+721.6, sellCostBuyPrice =sellCostBuyPrice+692.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+692.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+692.08
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+692.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+692.08
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+692.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+692.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+692.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1949', userid = '1', storedetaildate = '2026-10-21 09:34:08' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '82', '1', '361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2031', '1949', '1', '2026-10-21 09:34:08','0','0'); -- id=5077
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-837629.9',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-847882.75','10252.85', '0', '1', 'اضافة فاتورة مبيعات', '361', '-837629.9', '2026-10-21 09:34:08', '1',  'sellbillController.php','1','','0'); -- id=380
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10252.85', '10252.85', '2026-10-21', '1', '0', '0', '2026-10-21 09:34:08','اضافة فاتورة مبيعات رقم 361','1','0',null,'0','361','sellbillController.php?do=showDetail&sellbillid=361'); -- id=1844
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1844', '383', '10252.85', '','0'); -- id=1860
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '214320.39', 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 ('1844', '143', '10252.85', '','0'); -- id=1848
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1553998.5', 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 ( '9834.72', '9834.72', '2026-10-21', '1', '0', '0', '2026-10-21 09:34:08','اضافة فاتورة مبيعات رقم 361 - صرف البضاعة من المخزن','1','0',null,'0','361','sellbillController.php?do=showDetail&sellbillid=361'); -- id=1845
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1845', '402', '9834.72', '','0'); -- id=1861
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1387757.42', 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 ('1845', '382', '9834.72', '','0'); -- id=1849
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2182130.08', 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='1844,0,1845' where sellbillid=361;
 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-21', 10252.85, 9834.72, 9834.72
                    , 9834.78, 9834.72, 9834.78, 9834.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9834.72, 9834.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10252.85, sellCostBuyPrice =sellCostBuyPrice+9834.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9834.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9834.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9834.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9834.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9834.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9834.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9834.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 10252.85, 9834.72, 9834.72
                    , 9834.78, 9834.72, 9834.78, 9834.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9834.72, 9834.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10252.85, sellCostBuyPrice =sellCostBuyPrice+9834.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9834.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9834.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9834.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9834.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9834.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9834.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9834.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 10252.85, 9834.72, 9834.72
                    , 9834.78, 9834.72, 9834.78, 9834.72, 9834.72, 9834.78)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10252.85, netSellCostBuyPrice = netSellCostBuyPrice+9834.72
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9834.72
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9834.78
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9834.72
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9834.78
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9834.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9834.72
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9834.78;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad86a1f58f4e and sellbillId = 361 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:04:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:34:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:34:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4770
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:25:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:55:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:55:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4771
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:25:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:55:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:55:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:25:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:55:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:55:46', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=349'); -- id=4773
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:26:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:56:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:56:14', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4774
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 349;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 09:56:15', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '349';
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 = 2812;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-21 09:56:15' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '349', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48', '58', '1', '2026-10-19 09:53:42','0','0'); -- id=5078
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2813;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-21 09:56:15' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '349', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '53', '1', '2026-10-19 09:53:42','0','0'); -- id=5079
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 200;
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 = 2814;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '684', userid = '1', storedetaildate = '2026-10-21 09:56:15' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '0', '349', 'تعديل فاتورة مبيعات', 'sellbillController.php', '659', '684', '1', '2026-10-19 09:53:42','0','0'); -- id=5080
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 = 2815;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '589', userid = '1', storedetaildate = '2026-10-21 09:56:15' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '0', '349', 'تعديل فاتورة مبيعات', 'sellbillController.php', '564', '589', '1', '2026-10-19 09:53:42','0','0'); -- id=5081
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2816;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '83', userid = '1', storedetaildate = '2026-10-21 09:56:16' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '0', '349', 'تعديل فاتورة مبيعات', 'sellbillController.php', '78', '83', '1', '2026-10-19 09:53:42','0','0'); -- id=5082
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','3353.50','1367.50','1','تعديل فاتورة مبيعات','349', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '1367.5', '0', null, '0', null, null,'', '0','1','1','1367.5','1','2026-10-19 09:53:42','0','0','',''); -- id=616
UPDATE client SET  inUse = 0 where clientid = 46;
 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-21', 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1307.3, 1307.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1367.5, sellCostBuyPrice =sellCostBuyPrice-1307.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1307.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1307.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1307.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1307.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1307.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1307.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1307.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1307.3, 1307.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1367.5, sellCostBuyPrice =sellCostBuyPrice-1307.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1307.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1307.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1307.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1307.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1307.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1307.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1307.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3, 1307.3, 1307.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-1367.5, netSellCostBuyPrice = netSellCostBuyPrice-1307.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-1307.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-1307.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-1307.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-1307.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-1307.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-1307.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-1307.3;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '4793.5', '0', '1', '2807.5', '2807.5', '0', '2807.5', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '77', '349', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=362
UPDATE client SET  clientdebt = '4793.5', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','2807.5','0','اضافة فاتورة مبيعات (معدله)','362', '4793.5', '2026-10-21 09:56:16', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2807.5', '0', null, '0', null, null,'', '0','1','1','1367.5','1','2026-10-19 09:53:42','0','0','',''); -- id=617
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '362', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-21 09:56:17', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2876
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 = 2876;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-21 09:56:17' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '48', '1', '2026-10-21 09:56:17','0','0'); -- id=5083
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '362', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-10-21 09:56:17', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2877
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2877;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-21 09:56:17' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '53', '45', '1', '2026-10-21 09:56:17','0','0'); -- id=5084
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '362', '3', '100', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 09:56:17', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2878
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 = 2878;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '659', userid = '1', storedetaildate = '2026-10-21 09:56:18' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '684', '659', '1', '2026-10-21 09:56:18','0','0'); -- id=5085
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '362', '3', '101', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 09:56:18', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','235-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2879
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 = 2879;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '564', userid = '1', storedetaildate = '2026-10-21 09:56:18' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '589', '564', '1', '2026-10-21 09:56:18','0','0'); -- id=5086
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('31.86','00123', '362', '15', '123', '5.00', '34', '170', '0', '', '1', '2026-10-21 09:56:18', '123', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','170','0','','0','0.00','0','0','0','0'); -- id=2880
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2880;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-10-21 09:56:18' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '83', '78', '1', '2026-10-21 09:56:18','0','0'); -- id=5087
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 95;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '362', '19', '175', '4', '360', '1440', '0', '', '1', '2026-10-21 09:56:18', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','95-4,','1','1','0','0','360','1440','0','','0','0.00','0','0','0','0'); -- id=2881
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2881;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-21 09:56:19' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '1', '362', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '48', '44', '1', '2026-10-21 09:56:19','0','0'); -- id=5088
UPDATE dailyentry SET totalcreditor = '1367.50', totaldebtor = '1367.50', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 17:17:43', entryComment = 'اضافة فاتورة مبيعات رقم 349', fromFlag = '1',related='0',isopeningentry='0',operationId='349',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=349' WHERE id = '1793';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1367.50', '1367.50', '2026-10-21', '1', '0', '1793', '2026-10-21 09:56:19','تم عكس القيد رقم 1793 ','1','0','0','0','0',''); -- id=1846
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1846', '479', '1367.50', '','0'); -- id=1850
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1846', '143', '1367.50', '','0'); -- id=1862
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1552631', 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 = '1307.30', totaldebtor = '1307.30', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 17:17:43', entryComment = 'اضافة فاتورة مبيعات رقم 349 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='349',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=349' WHERE id = '1794';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1307.30', '1307.30', '2026-10-21', '1', '0', '1794', '2026-10-21 09:56:19','تم عكس القيد رقم 1794 ','1','0','0','0','0',''); -- id=1847
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1847', '402', '1307.30', '','0'); -- id=1851
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1386450.12', 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 ('1847', '382', '1307.30', '','0'); -- id=1863
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2183437.38', 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 ( '2807.5', '2807.5', '2026-10-21', '1', '0', '0', '2026-10-21 09:56:20','اضافة فاتورة مبيعات رقم 362','1','0',null,'0','362','sellbillController.php?do=showDetail&sellbillid=362'); -- id=1848
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1848', '479', '2807.5', '','0'); -- id=1864
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '4793.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1848', '143', '2807.5', '','0'); -- id=1852
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1555438.5', 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 ( '2607.3', '2607.3', '2026-10-21', '1', '0', '0', '2026-10-21 09:56:20','اضافة فاتورة مبيعات رقم 362 - صرف البضاعة من المخزن','1','0',null,'0','362','sellbillController.php?do=showDetail&sellbillid=362'); -- id=1849
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1849', '402', '2607.3', '','0'); -- id=1865
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1389057.42', 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 ('1849', '382', '2607.3', '','0'); -- id=1853
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180830.08', 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='1848,0,1849' where sellbillid=362;
 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-21', 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2607.3, 2607.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2807.5, sellCostBuyPrice =sellCostBuyPrice+2607.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2607.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2607.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2607.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2607.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2607.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2607.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2607.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2607.3, 2607.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2807.5, sellCostBuyPrice =sellCostBuyPrice+2607.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2607.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2607.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2607.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2607.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2607.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2607.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2607.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3, 2607.3, 2607.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2807.5, netSellCostBuyPrice = netSellCostBuyPrice+2607.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2607.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2607.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2607.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2607.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2607.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2607.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2607.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 349 and newid=362 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:26:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:56:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:56:21', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=362'); -- id=4775
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 06:26:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 09:56:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 09:56:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4776
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:33:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:03:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:03:26', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4777
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:35:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:05:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:05:48', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4778

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad87fdf0597b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(69,@clientdebt,@clientname,@treeIdis);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-21 11:05:48', '06ad87fdf0597b', '69', '5258.10', '1018.1', '0', '1', '4240', '4240', '0', '-4240', '1', '2026-10-21 11:05:48', '', '1', '0', 'العناني','1', '1', '5', '0', 'العناني', '90', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=25
UPDATE client SET  clientdebt = '1018.1', userid = '1' WHERE clientid = '69';
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 ('69','5258.10','4240','1','اضافة فاتورة مردوات مبيعات','25', '1018.1', '2026-10-21 11:05:48', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '4240', '0', null, '0', null, null,'', '0','1','1','4240','1','2026-10-21 11:05:48','0','0','',''); -- id=618
UPDATE client SET  inUse = 0 where clientid = 69;
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('180.00', '00131', '25', '15', '131', '8', '215', '1720', '0', '', '1', '0', '131', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','215','1720','0','','0'); -- id=123
UPDATE returnsellbilldetail SET  lastbuyprice = 180.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 180.00, meanbuyprice_withDiscount = 180.00
        , lastbuyprice_withTax = 180, meanbuyprice_withTax = 180, lastbuyprice_withDiscountAndTax = 180
                where returnsellbilldetailid = 123;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (131, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1720, 1440, 1440, 1440
                    , 1440, 1440, 1440, 0, 8, 0, 0, 1440, 1440)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1720, returnSellCostBuyPrice = returnSellCostBuyPrice+1440, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1440
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1440, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1440
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1440
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1440
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1440
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1440
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+8;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1720, 1440, 1440, 1440
                    , 1440, 1440, 1440, 0, 0, 1440, 1440)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1720, returnSellCostBuyPrice = returnSellCostBuyPrice+1440, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1440
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1440, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1440
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1440
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1440
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1440
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1440;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-21 11:05:49' WHERE storedetailid = '131';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('131', '1', '8', '0', '25', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '21', '29', '1', '2026-10-21 11:05:49','0','0'); -- id=5089
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('17.50', '00549', '25', '2', '549', '80', '28', '2240', '0', '', '1', '0', '549', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','28','2240','0','','0'); -- id=124
UPDATE returnsellbilldetail SET  lastbuyprice = 17.50 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.50, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where returnsellbilldetailid = 124;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (549, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2240, 1400, 1400, 1400
                    , 1400, 1400, 1400, 0, 80, 0, 0, 1400, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2240, returnSellCostBuyPrice = returnSellCostBuyPrice+1400, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1400
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1400, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1400
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1400
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1400
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1400
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+80;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2240, 1400, 1400, 1400
                    , 1400, 1400, 1400, 0, 0, 1400, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2240, returnSellCostBuyPrice = returnSellCostBuyPrice+1400, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1400
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1400, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1400
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1400
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1400
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1400
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '80', userid = '1', storedetaildate = '2026-10-21 11:05:49' WHERE storedetailid = '549';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('549', '1', '80', '0', '25', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '80', '1', '2026-10-21 11:05:49','0','0'); -- id=5090
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('105.00', '00588', '25', '23', '588', '2', '140', '280', '0', '', '1', '0', '588', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','140','280','0','','0'); -- id=125
UPDATE returnsellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where returnsellbilldetailid = 125;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (588, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 280, 210, 210, 210
                    , 210, 210, 210, 0, 2, 0, 0, 210, 210)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+280, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+210
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+210
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+210
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 280, 210, 210, 210
                    , 210, 210, 210, 0, 0, 210, 210)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+280, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+210
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+210
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+210;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-21 11:05:50' WHERE storedetailid = '588';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('588', '1', '2', '0', '25', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '6', '8', '1', '2026-10-21 11:05:50','0','0'); -- id=5091
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4240', '4240', '2026-10-21', '1', '0', '0', '2026-10-21 11:05:50','اضافة فاتورة مردود مبيعات رقم 25','1','0',null,'0','25','returnsellbillController.php?do=showDetail&returnsellbillid=25'); -- id=1850
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1850', '143', '4240', '','0'); -- id=1866
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1551198.5', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1850', '502', '4240', '','0'); -- id=1854
UPDATE accountstree SET name = 'العناني', customName = 'العناني', customNameEn = 'العناني', nameEn = 'العناني', parent = '58', accountNature = '0', theValue = '1018.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-18 14:30:20' WHERE id = '502';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3050', '3050', '2026-10-21', '1', '0', '0', '2026-10-21 11:05:50','اضافة فاتورة مردود مبيعات رقم 25 - صرف البضاعة من المخزن','1','0',null,'0','25','returnsellbillController.php?do=showDetail&returnsellbillid=25'); -- id=1851
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1851', '382', '3050', '','0'); -- id=1867
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2183880.08', 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 ('1851', '402', '3050', '','0'); -- id=1855
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1386007.42', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='1850,0,1851' where returnsellbillid=25;
 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4240, 3050, 3050, 3050
                    , 3050, 3050, 3050 ,0, 0, 3050, 1650)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4240, returnSellCostBuyPrice = returnSellCostBuyPrice+3050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1650;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (69, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4240, 3050, 3050, 3050
                    , 3050, 3050, 3050 ,0, 0, 3050, 1650)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4240, returnSellCostBuyPrice = returnSellCostBuyPrice+3050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1650;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -4240, -3050, -3050
                    , -3050, -3050, -3050, -3050, -3050, -1650)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-4240, netSellCostBuyPrice = netSellCostBuyPrice+-3050
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-3050
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-3050
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-3050
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-3050
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-3050
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-3050
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1650;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad87fdf0597b and sellbillId = 25 and returnsellbillId = 25
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:35:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:05:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:05:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4779
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:35:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:05:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:05:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4780
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:36:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:06:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:06:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:36:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:06:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-21 11:06:17', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4782
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:36:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:06:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-21 11:06:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4783
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:36:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:06:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-10-21 11:06:25', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=25'); -- id=4784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:36:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:06:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:06:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:37:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:07:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:07:05', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4786

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad8809eb07e1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(69,@clientdebt,@clientname,@treeIdis);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-21 11:07:05', '06ad8809eb07e1', '69', '1018.10', '268.1', '0', '1', '750', '750', '0', '-750', '1', '2026-10-21 11:07:05', '', '1', '0', 'العناني','1', '1', '5', '0', 'العناني', '6', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=26
UPDATE client SET  clientdebt = '268.1', userid = '1' WHERE clientid = '69';
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 ('69','1018.10','750','1','اضافة فاتورة مردوات مبيعات','26', '268.1', '2026-10-21 11:07:06', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '750', '0', null, '0', null, null,'', '0','1','1','750','1','2026-10-21 11:07:05','0','0','',''); -- id=619
UPDATE client SET  inUse = 0 where clientid = 69;
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('75.00', '00125', '26', '15', '125', '6', '125', '750', '0', '', '1', '0', '125', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','125','750','0','','0'); -- id=126
UPDATE returnsellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where returnsellbilldetailid = 126;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (125, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 750, 450, 450, 450
                    , 450, 450, 450, 0, 6, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+750, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+450
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+450
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+6;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 750, 450, 450, 450
                    , 450, 450, 450, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+750, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+450
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+450
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450;
UPDATE storedetail SET  productquantity = '73', userid = '1', storedetaildate = '2026-10-21 11:07:06' WHERE storedetailid = '125';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('125', '1', '6', '0', '26', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '67', '73', '1', '2026-10-21 11:07:06','0','0'); -- id=5092
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '750', '750', '2026-10-21', '1', '0', '0', '2026-10-21 11:07:06','اضافة فاتورة مردود مبيعات رقم 26','1','0',null,'0','26','returnsellbillController.php?do=showDetail&returnsellbillid=26'); -- id=1852
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1852', '143', '750', '','0'); -- id=1868
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1550448.5', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1852', '502', '750', '','0'); -- id=1856
UPDATE accountstree SET name = 'العناني', customName = 'العناني', customNameEn = 'العناني', nameEn = 'العناني', parent = '58', accountNature = '0', theValue = '268.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-18 14:30:20' WHERE id = '502';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '450', '450', '2026-10-21', '1', '0', '0', '2026-10-21 11:07:06','اضافة فاتورة مردود مبيعات رقم 26 - صرف البضاعة من المخزن','1','0',null,'0','26','returnsellbillController.php?do=showDetail&returnsellbillid=26'); -- id=1853
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1853', '382', '450', '','0'); -- id=1869
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2184330.08', 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 ('1853', '402', '450', '','0'); -- id=1857
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1385557.42', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='1852,0,1853' where returnsellbillid=26;
 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 750, 450, 450, 450
                    , 450, 450, 450 ,0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+750, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+450
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+450
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (69, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 750, 450, 450, 450
                    , 450, 450, 450 ,0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+750, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+450
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+450
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -750, -450, -450
                    , -450, -450, -450, -450, -450, -450)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-750, netSellCostBuyPrice = netSellCostBuyPrice+-450
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-450
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-450
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-450
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-450
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-450
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-450
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-450;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad8809eb07e1 and sellbillId = 26 and returnsellbillId = 26
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:37:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:07:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:07:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4787
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:38:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:08:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:08:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:55:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:25:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:25:46', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4789
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:55:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:25:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:25:52', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4790
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:55:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:25:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:25:59', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=362'); -- id=4791
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:56:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:26:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:26:20', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4792
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 362;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 11:26:21', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '362';
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 = 2876;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48', '58', '1', '2026-10-19 09:53:42','0','0'); -- id=5093
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2877;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '53', '1', '2026-10-19 09:53:42','0','0'); -- id=5094
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 200;
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 = 2878;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '684', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '659', '684', '1', '2026-10-19 09:53:42','0','0'); -- id=5095
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 235;
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 = 2879;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '589', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '564', '589', '1', '2026-10-19 09:53:42','0','0'); -- id=5096
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2880;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '83', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '78', '83', '1', '2026-10-19 09:53:42','0','0'); -- id=5097
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 95;
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2881;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1440, sellCostBuyPrice =sellCostBuyPrice-1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1440, sellCostBuyPrice =sellCostBuyPrice-1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-21 11:26:21' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '0', '362', 'تعديل فاتورة مبيعات', 'sellbillController.php', '44', '48', '1', '2026-10-19 09:53:42','0','0'); -- id=5098
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','4793.50','2807.50','1','تعديل فاتورة مبيعات','362', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2807.5', '0', null, '0', null, null,'', '0','1','1','2807.5','1','2026-10-19 09:53:42','0','0','',''); -- id=620
UPDATE client SET  inUse = 0 where clientid = 46;
 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-21', 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2607.3, 2607.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2807.5, sellCostBuyPrice =sellCostBuyPrice-2607.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2607.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2607.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2607.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2607.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2607.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2607.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2607.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2607.3, 2607.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2807.5, sellCostBuyPrice =sellCostBuyPrice-2607.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2607.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2607.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2607.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2607.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2607.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2607.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2607.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2807.5, 2607.3, 2607.3
                    , 2607.3, 2607.3, 2607.3, 2607.3, 2607.3, 2607.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2807.5, netSellCostBuyPrice = netSellCostBuyPrice-2607.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-2607.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-2607.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-2607.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-2607.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-2607.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2607.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-2607.3;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '4933.5', '0', '1', '2947.5', '2947.5', '0', '2947.5', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '78', '362', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=363
UPDATE client SET  clientdebt = '4933.5', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','2947.5','0','اضافة فاتورة مبيعات (معدله)','363', '4933.5', '2026-10-21 11:26:22', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2947.5', '0', null, '0', null, null,'', '0','1','1','2807.5','1','2026-10-19 09:53:42','0','0','',''); -- id=621
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '363', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-21 11:26:22', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2882
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 = 2882;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-21 11:26:23' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '48', '1', '2026-10-21 11:26:23','0','0'); -- id=5099
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '363', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-10-21 11:26:23', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2883
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2883;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-21 11:26:23' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '53', '45', '1', '2026-10-21 11:26:23','0','0'); -- id=5100
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '363', '3', '100', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 11:26:23', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2884
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 = 2884;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '659', userid = '1', storedetaildate = '2026-10-21 11:26:23' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '684', '659', '1', '2026-10-21 11:26:23','0','0'); -- id=5101
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '363', '3', '101', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 11:26:23', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','235-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2885
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 = 2885;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '564', userid = '1', storedetaildate = '2026-10-21 11:26:24' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '589', '564', '1', '2026-10-21 11:26:24','0','0'); -- id=5102
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('31.86','00123', '363', '15', '123', '5.00', '34', '170', '0', '', '1', '2026-10-21 11:26:24', '123', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','170','0','','0','0.00','0','0','0','0'); -- id=2886
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2886;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-10-21 11:26:24' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '83', '78', '1', '2026-10-21 11:26:24','0','0'); -- id=5103
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 95;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '363', '19', '175', '4.00', '360', '1440', '0', '', '1', '2026-10-21 11:26:24', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','95-4,','1','1','0','0','360','1440','0','','0','0.00','0','0','0','0'); -- id=2887
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2887;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-21 11:26:24' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '48', '44', '1', '2026-10-21 11:26:24','0','0'); -- id=5104
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00160', '363', '22', '160', '1', '140', '140', '0', '', '1', '2026-10-21 11:26:24', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','73-1,','1','1','0','0','140','140','0','','0','0.00','0','0','0','0'); -- id=2888
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 2888;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '1', storedetaildate = '2026-10-21 11:26:25' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '1', '1', '363', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '88', '87', '1', '2026-10-21 11:26:25','0','0'); -- id=5105
UPDATE dailyentry SET totalcreditor = '2807.50', totaldebtor = '2807.50', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 09:56:20', entryComment = 'اضافة فاتورة مبيعات رقم 362', fromFlag = '1',related='0',isopeningentry='0',operationId='362',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=362' WHERE id = '1848';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2807.50', '2807.50', '2026-10-21', '1', '0', '1848', '2026-10-21 11:26:25','تم عكس القيد رقم 1848 ','1','0','0','0','0',''); -- id=1854
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1854', '479', '2807.50', '','0'); -- id=1858
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1854', '143', '2807.50', '','0'); -- id=1870
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1547641', 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 = '2607.30', totaldebtor = '2607.30', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 09:56:20', entryComment = 'اضافة فاتورة مبيعات رقم 362 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='362',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=362' WHERE id = '1849';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2607.30', '2607.30', '2026-10-21', '1', '0', '1849', '2026-10-21 11:26:25','تم عكس القيد رقم 1849 ','1','0','0','0','0',''); -- id=1855
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1855', '402', '2607.30', '','0'); -- id=1859
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1382950.12', 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 ('1855', '382', '2607.30', '','0'); -- id=1871
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2186937.38', 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 ( '2947.5', '2947.5', '2026-10-21', '1', '0', '0', '2026-10-21 11:26:26','اضافة فاتورة مبيعات رقم 363','1','0',null,'0','363','sellbillController.php?do=showDetail&sellbillid=363'); -- id=1856
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1856', '479', '2947.5', '','0'); -- id=1872
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '4933.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1856', '143', '2947.5', '','0'); -- id=1860
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1550588.5', 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 ( '2727.3', '2727.3', '2026-10-21', '1', '0', '0', '2026-10-21 11:26:26','اضافة فاتورة مبيعات رقم 363 - صرف البضاعة من المخزن','1','0',null,'0','363','sellbillController.php?do=showDetail&sellbillid=363'); -- id=1857
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1857', '402', '2727.3', '','0'); -- id=1873
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1385677.42', 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 ('1857', '382', '2727.3', '','0'); -- id=1861
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2184210.08', 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='1856,0,1857' where sellbillid=363;
 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-21', 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2727.3, 2727.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2947.5, sellCostBuyPrice =sellCostBuyPrice+2727.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2727.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2727.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2727.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2727.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2727.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2727.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2727.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2727.3, 2727.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2947.5, sellCostBuyPrice =sellCostBuyPrice+2727.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2727.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2727.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2727.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2727.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2727.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2727.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2727.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3, 2727.3, 2727.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2947.5, netSellCostBuyPrice = netSellCostBuyPrice+2727.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2727.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2727.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2727.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2727.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2727.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2727.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2727.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 362 and newid=363 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:56:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:26:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:26:27', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=363'); -- id=4793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 07:59:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:29:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:29:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4794
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:12:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:42:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 11:42:03', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4795
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:12:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:42:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 11:42:19', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4796

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =622
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-21 11:42:20', userid = '1' WHERE clientid = '2';
UPDATE client SET  inUse = 0 where clientid = 2;
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 ('2','1220.00','1220','1','ايصال تحصيل (( قبض من عميل ))','622', '0', '2026-10-21 11:42:03', '1', 'clientPayedDeptController.php', '   ', '1220', '0', null, '0', null, null,'', '-1','1','1','1220','1','','65','0','','.'); -- id=622
UPDATE save SET  savecurrentvalue = '-836409.9',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-837629.90','1220', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '622', '-836409.9', '2026-10-21 11:42:20', '1',  'clientPayedDeptController.php','2','','0'); -- id=381
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1220', '1220', '2026-10-21', '1', '0', '0', '2026-10-21 11:42:20','اضافة ايصال سداد للعميل فؤاد الطوخي','1','0','0','0','622','clientPayedDeptController.php?do=show&id=622'); -- id=1858
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1858', '383', '1220', '','0'); -- id=1874
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '215540.39', 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 ('1858', '426', '1220', '','0'); -- id=1862
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-13 20:11:03' WHERE id = '426';
UPDATE clientdebtchange SET clientid = '2', clientdebtchangebefore = '1220.000', clientdebtchangeamount = '1220.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '622', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-21 11:42:03', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '1220.000',discount='', reciptid='0', dailyentryid = '1858',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1220',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '622';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:12:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:42:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 11:42:21', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:12:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:42:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 11:42:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:12:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:42:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:42:48', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4799
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:13:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:43:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:43:40', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4800

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad88918f25d0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@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-21 11:43:41', '06ad88918f25d0', '2', '0.00', '3000.64', '23.5', '2', '3922.40', '3000.64', '0', '3000.64', '1', '2026-10-21 11:43:41', '', '1', '0', 'فؤاد الطوخي', '1', '1', '3', '0', 'فؤاد الطوخي', '10' ,'0','','','','','-1','0','0','0','0','0','3000','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-21','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=364
UPDATE client SET  clientdebt = '3000.64', userid = '1' WHERE clientid = '2';
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 ('2','0.00','3000.64','0','اضافة فاتورة مبيعات','364', '3000.64', '2026-10-21 11:43:41', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3000.64', '0', null, '0', null, null,'', '0','1','1','3000.64','1','2026-10-21 11:43:41','0','0','',''); -- id=623
UPDATE client SET  inUse = 0 where clientid = 2;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 156;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '364', '1', '9', '10', '392.24', '3922.4', '0', '', '1', '2026-10-21 11:43:41', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','156-10,','1','1','0','0','392.24','3922.4','0','','0','0.00','0','0','0','0'); -- id=2889
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 2889;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-21', 3000.64, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000.64, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 3000.64, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000.64, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '185', userid = '1', storedetaildate = '2026-10-21 11:43:42' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '10', '1', '364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '195', '185', '1', '2026-10-21 11:43:42','0','0'); -- id=5106
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3922.4', '3922.4', '2026-10-21', '1', '0', '0', '2026-10-21 11:43:42','اضافة فاتورة مبيعات رقم 364','1','0',null,'0','364','sellbillController.php?do=showDetail&sellbillid=364'); -- id=1859
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1859', '426', '3000.64', '','0'); -- id=1875
UPDATE accountstree SET name = 'فؤاد الطوخي', customName = 'فؤاد الطوخي', customNameEn = 'فؤاد الطوخي', nameEn = 'فؤاد الطوخي', parent = '58', accountNature = '0', theValue = '3000.64', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-13 20:11:03' WHERE id = '426';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1859', '398', '921.76', '','0'); -- id=1876
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '56550.13', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1859', '143', '3922.4', '','0'); -- id=1863
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1554510.9', 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 ( '3060', '3060', '2026-10-21', '1', '0', '0', '2026-10-21 11:43:42','اضافة فاتورة مبيعات رقم 364 - صرف البضاعة من المخزن','1','0',null,'0','364','sellbillController.php?do=showDetail&sellbillid=364'); -- id=1860
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1860', '402', '3060', '','0'); -- id=1877
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1388737.42', 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 ('1860', '382', '3060', '','0'); -- id=1864
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2181150.08', 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='1859,0,1860' where sellbillid=364;
 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-21', 3000.64, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000.64, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-21', 3000.64, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000.64, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3000.64, 3060, 3060
                    , 3060, 3060, 3060, 3060, 3060, 3060)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3000.64, netSellCostBuyPrice = netSellCostBuyPrice+3060
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3060
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3060
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3060
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3060
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3060
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3060
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3060;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad88918f25d0 and sellbillId = 364 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 08:13:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 11:43:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 11:43:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:32:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:02:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:02:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:38:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:08:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:08:06', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4803

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad89be1b8eda
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-21 13:08:07', '06ad89be1b8eda', '1', '0.00', '0', '0', '1', '468.3', '468.3', '-468.3', '0', '1', '2026-10-21 13:08:07', '', '1', '0', 'نقدي','1', '0', '5', '0', 'نقدي', '29', '0', '', '','','','-1','0','0','0','','0','-468.3','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=27
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','27', '0', '2026-10-21 13:08:07', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '468.3', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-21 13:08:07','0','0','',''); -- id=624
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('15.00', '00105', '27', '3', '105', '4', '15', '60', '0', '', '1', '0', '105', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','15','60','0','','0'); -- id=127
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 127;
 INSERT INTO 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 60, 60, 60, 60
                    , 60, 60, 60, 0, 4, 0, 0, 60, 60)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+60, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+60
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+60, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+60
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+60
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+60
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+60
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+60
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 60, 60, 60, 60
                    , 60, 60, 60, 0, 0, 60, 60)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+60, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+60
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+60, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+60
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+60
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+60
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+60
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+60;
UPDATE storedetail SET  productquantity = '134', userid = '1', storedetaildate = '2026-10-21 13:08:08' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '4', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '130', '134', '1', '2026-10-21 13:08:08','0','0'); -- id=5107
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('11.75', '00102', '27', '3', '102', '4', '12', '48', '0', '', '1', '0', '102', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','12','48','0','','0'); -- id=128
UPDATE returnsellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where returnsellbilldetailid = 128;
 INSERT INTO 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 48, 47, 47, 47
                    , 47, 47, 47, 0, 4, 0, 0, 47, 47)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+48, returnSellCostBuyPrice = returnSellCostBuyPrice+47, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+47
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+47, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+47
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+47
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+47
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+47
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+47
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 48, 47, 47, 47
                    , 47, 47, 47, 0, 0, 47, 47)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+48, returnSellCostBuyPrice = returnSellCostBuyPrice+47, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+47
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+47, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+47
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+47
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+47
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+47
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+47;
UPDATE storedetail SET  productquantity = '1964', userid = '1', storedetaildate = '2026-10-21 13:08:08' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '4', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1960', '1964', '1', '2026-10-21 13:08:08','0','0'); -- id=5108
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('17.60', '00101', '27', '3', '101', '5', '17.75', '88.75', '0', '', '1', '0', '101', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','17.75','88.75','0','','0'); -- id=129
UPDATE returnsellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where returnsellbilldetailid = 129;
 INSERT INTO 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 88.75, 88, 88, 88
                    , 88, 88, 88, 0, 5, 0, 0, 88, 88)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+88.75, returnSellCostBuyPrice = returnSellCostBuyPrice+88, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+88
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+88, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+88
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+88
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+88
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+88
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+88
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 88.75, 88, 88, 88
                    , 88, 88, 88, 0, 0, 88, 88)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+88.75, returnSellCostBuyPrice = returnSellCostBuyPrice+88, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+88
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+88, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+88
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+88
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+88
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+88
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+88;
UPDATE storedetail SET  productquantity = '569', userid = '1', storedetaildate = '2026-10-21 13:08:08' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '5', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '564', '569', '1', '2026-10-21 13:08:08','0','0'); -- id=5109
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('17.60', '00100', '27', '3', '100', '4', '17.75', '71', '0', '', '1', '0', '100', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','17.75','71','0','','0'); -- id=130
UPDATE returnsellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where returnsellbilldetailid = 130;
 INSERT INTO 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 71, 70.4, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 0, 4, 0, 0, 70.4, 70.4)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+71, returnSellCostBuyPrice = returnSellCostBuyPrice+70.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+70.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+70.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+70.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+70.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+70.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+70.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+70.4
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+4;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 71, 70.4, 70.4, 70.4
                    , 70.4, 70.4, 70.4, 0, 0, 70.4, 70.4)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+71, returnSellCostBuyPrice = returnSellCostBuyPrice+70.4, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+70.4
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+70.4, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+70.4
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+70.4
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+70.4
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+70.4
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+70.4;
UPDATE storedetail SET  productquantity = '663', userid = '1', storedetaildate = '2026-10-21 13:08:08' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '4', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '659', '663', '1', '2026-10-21 13:08:09','0','0'); -- id=5110
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('85.97', '00115', '27', '3', '115', '1', '90.5', '90.5', '0', '', '1', '0', '115', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','90.5','90.5','0','','0'); -- id=131
UPDATE returnsellbilldetail SET  lastbuyprice = 85.97 , meanbuyprice = 87.29, lastbuyprice_withDiscount = 85.97, meanbuyprice_withDiscount = 87.29
        , lastbuyprice_withTax = 85.97, meanbuyprice_withTax = 87.29, lastbuyprice_withDiscountAndTax = 85.97
                where returnsellbilldetailid = 131;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (115, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 90.5, 85.97, 85.97, 87.29
                    , 85.97, 87.29, 85.97, 0, 1, 0, 0, 85.97, 87.29)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+90.5, returnSellCostBuyPrice = returnSellCostBuyPrice+85.97, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+85.97
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+87.29, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+85.97
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+87.29
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+85.97
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+85.97
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+87.29
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 90.5, 85.97, 85.97, 87.29
                    , 85.97, 87.29, 85.97, 0, 0, 85.97, 87.29)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+90.5, returnSellCostBuyPrice = returnSellCostBuyPrice+85.97, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+85.97
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+87.29, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+85.97
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+87.29
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+85.97
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+85.97
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+87.29;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-10-21 13:08:09' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '1', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '45', '46', '1', '2026-10-21 13:08:09','0','0'); -- id=5111
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('4.50', '00103', '27', '3', '103', '10', '5.5', '55', '0', '', '1', '0', '103', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','5.5','55','0','','0'); -- id=132
UPDATE returnsellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where returnsellbilldetailid = 132;
 INSERT INTO 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 55, 45, 45, 45
                    , 45, 45, 45, 0, 10, 0, 0, 45, 45)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+55, returnSellCostBuyPrice = returnSellCostBuyPrice+45, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+45
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+45, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+45
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+45
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+45
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+45
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+45
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+10;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 55, 45, 45, 45
                    , 45, 45, 45, 0, 0, 45, 45)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+55, returnSellCostBuyPrice = returnSellCostBuyPrice+45, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+45
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+45, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+45
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+45
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+45
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+45
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+45;
UPDATE storedetail SET  productquantity = '3460', userid = '1', storedetaildate = '2026-10-21 13:08:09' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '10', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '3450', '3460', '1', '2026-10-21 13:08:09','0','0'); -- id=5112
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('52.50', '00119', '27', '3', '119', '1', '55', '55', '0', '', '1', '0', '119', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','55','55','0','','0'); -- id=133
UPDATE returnsellbilldetail SET  lastbuyprice = 52.50 , meanbuyprice = 53.18, lastbuyprice_withDiscount = 52.50, meanbuyprice_withDiscount = 53.18
        , lastbuyprice_withTax = 52.5, meanbuyprice_withTax = 53.18, lastbuyprice_withDiscountAndTax = 52.5
                where returnsellbilldetailid = 133;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (119, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 55, 52.5, 52.5, 53.18
                    , 52.5, 53.18, 52.5, 0, 1, 0, 0, 52.5, 53.18)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+55, returnSellCostBuyPrice = returnSellCostBuyPrice+52.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+52.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+53.18, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+52.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+53.18
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+52.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+52.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+53.18
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 55, 52.5, 52.5, 53.18
                    , 52.5, 53.18, 52.5, 0, 0, 52.5, 53.18)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+55, returnSellCostBuyPrice = returnSellCostBuyPrice+52.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+52.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+53.18, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+52.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+53.18
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+52.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+52.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+53.18;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-21 13:08:09' WHERE storedetailid = '119';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('119', '1', '1', '0', '27', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '34', '35', '1', '2026-10-21 13:08:09','0','0'); -- id=5113
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-836878.175',  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 ('-836409.875','-468.3', '1', '1', 'اضافة فاتورة مردوات مبيعات', '27', '-836878.175', '2026-10-21 13:08:10', '1',  'returnsellbillController.php','1','','0'); -- id=382
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '468.3', '468.3', '2026-10-21', '1', '0', '0', '2026-10-21 13:08:10','اضافة فاتورة مردود مبيعات رقم 27','1','0',null,'0','27','returnsellbillController.php?do=showDetail&returnsellbillid=27'); -- id=1861
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1861', '143', '468.3', '','0'); -- id=1878
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1554042.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1861', '383', '468.3', '','0'); -- id=1865
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '215072.09', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '448.87', '448.87', '2026-10-21', '1', '0', '0', '2026-10-21 13:08:10','اضافة فاتورة مردود مبيعات رقم 27 - صرف البضاعة من المخزن','1','0',null,'0','27','returnsellbillController.php?do=showDetail&returnsellbillid=27'); -- id=1862
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1862', '382', '448.87', '','0'); -- id=1879
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2181598.95', 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 ('1862', '402', '448.87', '','0'); -- id=1866
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1388288.55', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='1861,0,1862' where returnsellbillid=27;
 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 468.3, 448.87, 448.87, 450.87
                    , 448.87, 450.87, 448.87 ,0, 0, 448.87, 450.87)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+468.3, returnSellCostBuyPrice = returnSellCostBuyPrice+448.87, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+448.87
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450.87, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+448.87
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450.87
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+448.87
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+448.87
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450.87;
 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-21', 0, 0, 0
                    , 0, 0, 0, 0
                    , 468.3, 448.87, 448.87, 450.87
                    , 448.87, 450.87, 448.87 ,0, 0, 448.87, 450.87)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+468.3, returnSellCostBuyPrice = returnSellCostBuyPrice+448.87, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+448.87
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450.87, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+448.87
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+450.87
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+448.87
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+448.87
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450.87;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -468.3, -448.87, -448.87
                    , -450.87, -448.87, -450.87, -448.87, -448.87, -450.87)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-468.3, netSellCostBuyPrice = netSellCostBuyPrice+-448.87
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-448.87
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-450.87
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-448.87
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-450.87
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-448.87
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-448.87
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-450.87;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad89be1b8eda and sellbillId = 27 and returnsellbillId = 27
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:38:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:08:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:08:12', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4804
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:54:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:24:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:24:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4805
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('محمد حسن' , '', '', '', '0', '', '0', '2026-10-21 13:25:01', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-10-21','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=75
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('75', '0', '0', '', ''); -- id=75
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 ('75','0','0','0','إضافة عميل جديد','75', '0', '2026-10-21 13:25:01', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=625
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('محمد حسن', 'محمد حسن', 'محمد حسن', 'محمد حسن', '58', '0', '0', '0', '', '1', '1', '', '0', '3', '1', '', '1', '0', '2026-10-21 13:25:02'); -- id=508
UPDATE client SET clientname = 'محمد حسن', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-10-21', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='508',husbandNameObgy='',txtNameE='',facility='',delegate='',txtemail='',commercial='',valtaxnumber='',clientaddress2='',country='',delegateid='-1',datecustomeraccount='0000-00-00',taxfile='',fileimg='',webStoreType='0',clientaddress3='',tagids='',email_verified='0',email_otp='0',email_otp_expiry='0000-00-00 00:00:00' WHERE clientid = '75';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:55:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:25:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:25:24', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4806

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad8a0f3a604d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(75,@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-21 13:25:25', '06ad8a0f3a604d', '75', '0.00', '275', '0', '1', '275.00', '275', '0', '275', '1', '2026-10-21 13:25:25', '', '1', '0', 'محمد حسن', '1', '1', '3', '0', 'محمد حسن', '50' ,'0','','','','','-1','0','0','0','0','0','275','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-21','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=365
UPDATE client SET  clientdebt = '275', userid = '1' WHERE clientid = '75';
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 ('75','0.00','275','0','اضافة فاتورة مبيعات','365', '275', '2026-10-21 13:25:25', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '275', '0', null, '0', null, null,'', '0','1','1','275','1','2026-10-21 13:25:25','0','0','',''); -- id=626
UPDATE client SET  inUse = 0 where clientid = 75;
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', '365', '20', '388', '50', '5.5', '275', '0', '', '1', '2026-10-21 13:25:25', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-50,','1','1','0','0','5.5','275','0','','0','0.00','0','0','0','0'); -- id=2890
UPDATE sellbilldetail SET  lastbuyprice = 4.83 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.83, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.83, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.83
                where sellbilldetailid = 2890;
 INSERT INTO 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-21', 275, 241.5, 241.5
                    , 241, 241.5, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 241.5, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+241.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241.5
                            , 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-21', 275, 241.5, 241.5
                    , 241, 241.5, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0, 241.5, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+241.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241.5
                            , 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 = '2513', userid = '1', storedetaildate = '2026-10-21 13:25:26' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '50', '1', '365', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2563', '2513', '1', '2026-10-21 13:25:26','0','0'); -- id=5114
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '275', '275', '2026-10-21', '1', '0', '0', '2026-10-21 13:25:26','اضافة فاتورة مبيعات رقم 365','1','0',null,'0','365','sellbillController.php?do=showDetail&sellbillid=365'); -- id=1863
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1863', '508', '275', '','0'); -- id=1880
UPDATE accountstree SET name = 'محمد حسن', customName = 'محمد حسن', customNameEn = 'محمد حسن', nameEn = 'محمد حسن', parent = '58', accountNature = '0', theValue = '275', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-21 13:25:02' WHERE id = '508';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1863', '143', '275', '','0'); -- id=1867
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1554317.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '241.5', '241.5', '2026-10-21', '1', '0', '0', '2026-10-21 13:25:26','اضافة فاتورة مبيعات رقم 365 - صرف البضاعة من المخزن','1','0',null,'0','365','sellbillController.php?do=showDetail&sellbillid=365'); -- id=1864
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1864', '402', '241.5', '','0'); -- id=1881
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1388530.05', 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 ('1864', '382', '241.5', '','0'); -- id=1868
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2181357.45', 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='1863,0,1864' where sellbillid=365;
 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-21', 275, 241.5, 241.5
                    , 241, 241.5, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,241.5, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+241.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241.5
                            , 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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (75, '2026-10-21', 275, 241.5, 241.5
                    , 241, 241.5, 241, 241
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,241.5, 241, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+275, sellCostBuyPrice =sellCostBuyPrice+241.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+241.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+241
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+241.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+241
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+241
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+241.5
                            , 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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 275, 241.5, 241.5
                    , 241, 241.5, 241, 241, 241.5, 241)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+275, netSellCostBuyPrice = netSellCostBuyPrice+241.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+241.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+241
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+241.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+241
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+241
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+241.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+241;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad8a0f3a604d and sellbillId = 365 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 09:55:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 13:25:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 13:25:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4807
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 11:28:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 14:58:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 14:58:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4808
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 11:28:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 14:58:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 14:58:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 11:28:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 14:58:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 14:58:32', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=363'); -- id=4810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 11:28:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 14:58:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 14:58:50', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4811
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 363;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 14:58:51', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '363';
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 = 2882;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48', '58', '1', '2026-10-19 09:53:42','0','0'); -- id=5115
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2883;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '53', '1', '2026-10-19 09:53:42','0','0'); -- id=5116
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 200;
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 = 2884;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '688', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '663', '688', '1', '2026-10-19 09:53:42','0','0'); -- id=5117
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 235;
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 = 2885;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '594', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '569', '594', '1', '2026-10-19 09:53:42','0','0'); -- id=5118
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2886;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '83', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '78', '83', '1', '2026-10-19 09:53:42','0','0'); -- id=5119
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 95;
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2887;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1440, sellCostBuyPrice =sellCostBuyPrice-1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1440, sellCostBuyPrice =sellCostBuyPrice-1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-21 14:58:51' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '44', '48', '1', '2026-10-19 09:53:42','0','0'); -- id=5120
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 73;
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 2888;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-140, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-140, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2026-10-21 14:58:52' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '1', '0', '363', 'تعديل فاتورة مبيعات', 'sellbillController.php', '87', '88', '1', '2026-10-19 09:53:42','0','0'); -- id=5121
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','4933.50','2947.50','1','تعديل فاتورة مبيعات','363', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2947.5', '0', null, '0', null, null,'', '0','1','1','2947.5','1','2026-10-19 09:53:42','0','0','',''); -- id=627
UPDATE client SET  inUse = 0 where clientid = 46;
 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-21', 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2727.3, 2727.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2947.5, sellCostBuyPrice =sellCostBuyPrice-2727.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2727.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2727.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2727.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2727.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2727.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2727.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2727.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2727.3, 2727.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2947.5, sellCostBuyPrice =sellCostBuyPrice-2727.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2727.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2727.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2727.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2727.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2727.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2727.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2727.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2947.5, 2727.3, 2727.3
                    , 2727.3, 2727.3, 2727.3, 2727.3, 2727.3, 2727.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2947.5, netSellCostBuyPrice = netSellCostBuyPrice-2727.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-2727.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-2727.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-2727.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-2727.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-2727.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2727.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-2727.3;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '4963.5', '0', '1', '2977.5', '2977.5', '0', '2977.5', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '80', '363', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=366
UPDATE client SET  clientdebt = '4963.5', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','2977.5','0','اضافة فاتورة مبيعات (معدله)','366', '4963.5', '2026-10-21 14:58:52', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2977.5', '0', null, '0', null, null,'', '0','1','1','2947.5','1','2026-10-19 09:53:42','0','0','',''); -- id=628
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '366', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-21 14:58:53', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2891
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 = 2891;
 INSERT INTO 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-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-21 14:58:53' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '48', '1', '2026-10-21 14:58:53','0','0'); -- id=5122
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '366', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-10-21 14:58:53', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2892
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2892;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-21 14:58:53' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '53', '45', '1', '2026-10-21 14:58:53','0','0'); -- id=5123
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '366', '3', '100', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 14:58:53', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2893
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 = 2893;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '663', userid = '1', storedetaildate = '2026-10-21 14:58:54' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '688', '663', '1', '2026-10-21 14:58:54','0','0'); -- id=5124
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 235;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '366', '3', '101', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-21 14:58:54', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','235-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2894
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 = 2894;
 INSERT INTO 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-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '569', userid = '1', storedetaildate = '2026-10-21 14:58:54' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '594', '569', '1', '2026-10-21 14:58:54','0','0'); -- id=5125
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('31.86','00123', '366', '15', '123', '5.00', '34', '170', '0', '', '1', '2026-10-21 14:58:54', '123', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','170','0','','0','0.00','0','0','0','0'); -- id=2895
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2895;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-10-21 14:58:54' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '83', '78', '1', '2026-10-21 14:58:54','0','0'); -- id=5126
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 95;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '366', '19', '175', '4.00', '360', '1440', '0', '', '1', '2026-10-21 14:58:54', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','95-4,','1','1','0','0','360','1440','0','','0','0.00','0','0','0','0'); -- id=2896
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 2896;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-10-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1440, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-10-21 14:58:55' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '48', '44', '1', '2026-10-21 14:58:55','0','0'); -- id=5127
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('120','00160', '366', '22', '160', '1.00', '140', '140', '0', '', '1', '2026-10-21 14:58:55', '160', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','73-1,','1','1','0','0','140','140','0','','0','0.00','0','0','0','0'); -- id=2897
UPDATE sellbilldetail SET  lastbuyprice = 120.00 , meanbuyprice = 120.00, lastbuyprice_withDiscount = 120.00, meanbuyprice_withDiscount = 120.00
        , lastbuyprice_withTax = 120, meanbuyprice_withTax = 120, lastbuyprice_withDiscountAndTax = 120
                where sellbilldetailid = 2897;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (160, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 140, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '1', storedetaildate = '2026-10-21 14:58:55' WHERE storedetailid = '160';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('160', '1', '1', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '88', '87', '1', '2026-10-21 14:58:55','0','0'); -- id=5128
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13','00191', '366', '20', '191', '2', '15', '30', '0', '', '1', '2026-10-21 14:58:55', '191', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','30','0','','0','0.00','0','0','0','0'); -- id=2898
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 2898;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (191, '2026-10-21', 30, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+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-21', 30, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '328', userid = '1', storedetaildate = '2026-10-21 14:58:55' WHERE storedetailid = '191';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('191', '1', '2', '1', '366', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '330', '328', '1', '2026-10-21 14:58:55','0','0'); -- id=5129
UPDATE dailyentry SET totalcreditor = '2947.50', totaldebtor = '2947.50', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 11:26:26', entryComment = 'اضافة فاتورة مبيعات رقم 363', fromFlag = '1',related='0',isopeningentry='0',operationId='363',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=363' WHERE id = '1856';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2947.50', '2947.50', '2026-10-21', '1', '0', '1856', '2026-10-21 14:58:56','تم عكس القيد رقم 1856 ','1','0','0','0','0',''); -- id=1865
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1865', '479', '2947.50', '','0'); -- id=1869
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1865', '143', '2947.50', '','0'); -- id=1882
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1551370.1', 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 = '2727.30', totaldebtor = '2727.30', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 11:26:26', entryComment = 'اضافة فاتورة مبيعات رقم 363 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='363',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=363' WHERE id = '1857';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2727.30', '2727.30', '2026-10-21', '1', '0', '1857', '2026-10-21 14:58:56','تم عكس القيد رقم 1857 ','1','0','0','0','0',''); -- id=1866
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1866', '402', '2727.30', '','0'); -- id=1870
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1385802.75', 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 ('1866', '382', '2727.30', '','0'); -- id=1883
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2184084.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2977.5', '2977.5', '2026-10-21', '1', '0', '0', '2026-10-21 14:58:57','اضافة فاتورة مبيعات رقم 366','1','0',null,'0','366','sellbillController.php?do=showDetail&sellbillid=366'); -- id=1867
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1867', '479', '2977.5', '','0'); -- id=1884
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '4963.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1867', '143', '2977.5', '','0'); -- id=1871
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1554347.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2753.3', '2753.3', '2026-10-21', '1', '0', '0', '2026-10-21 14:58:57','اضافة فاتورة مبيعات رقم 366 - صرف البضاعة من المخزن','1','0',null,'0','366','sellbillController.php?do=showDetail&sellbillid=366'); -- id=1868
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1868', '402', '2753.3', '','0'); -- id=1885
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1388556.05', 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 ('1868', '382', '2753.3', '','0'); -- id=1872
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2181331.45', 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='1867,0,1868' where sellbillid=366;
 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-21', 2977.5, 2753.3, 2753.3
                    , 2753.3, 2753.3, 2753.3, 2753.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2753.3, 2753.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2977.5, sellCostBuyPrice =sellCostBuyPrice+2753.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2753.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2753.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2753.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2753.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2753.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2753.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2753.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-21', 2977.5, 2753.3, 2753.3
                    , 2753.3, 2753.3, 2753.3, 2753.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2753.3, 2753.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2977.5, sellCostBuyPrice =sellCostBuyPrice+2753.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2753.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2753.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2753.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2753.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2753.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2753.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2753.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2977.5, 2753.3, 2753.3
                    , 2753.3, 2753.3, 2753.3, 2753.3, 2753.3, 2753.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2977.5, netSellCostBuyPrice = netSellCostBuyPrice+2753.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2753.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2753.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2753.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2753.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2753.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2753.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2753.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 363 and newid=366 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 11:28:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 14:58:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 14:58:58', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=366'); -- id=4812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:23:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:53:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:53:40', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:23:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:53:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:53:57', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4814
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:24:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:54:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:54:03', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=275'); -- id=4815
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:24:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:54:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:54:41', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4816
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 275;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 15:54:41', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '275';
UPDATE sellbilldetail SET  lastbuyprice = 1100.00 , meanbuyprice = 1100.00, lastbuyprice_withDiscount = 1100.00, meanbuyprice_withDiscount = 1100.00
        , lastbuyprice_withTax = 1100, meanbuyprice_withTax = 1100, lastbuyprice_withDiscountAndTax = 1100
                where sellbilldetailid = 2247;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (473, '2026-10-21', 1495, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1495, sellCostBuyPrice =sellCostBuyPrice-1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 1495, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1495, sellCostBuyPrice =sellCostBuyPrice-1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-21 15:54:41' WHERE storedetailid = '473';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('473', '1', '1', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '4', '1', '2026-10-11 20:54:37','0','0'); -- id=5130
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 32;
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 2248;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-970, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-970, sellCostBuyPrice =sellCostBuyPrice-850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-850, sellCostMeanBuyPrice = sellCostMeanBuyPrice-850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-850
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-21 15:54:41' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '23', '25', '1', '2026-10-11 20:54:37','0','0'); -- id=5131
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 31;
UPDATE sellbilldetail SET  lastbuyprice = 1400.00 , meanbuyprice = 1400.00, lastbuyprice_withDiscount = 1400.00, meanbuyprice_withDiscount = 1400.00
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where sellbilldetailid = 2249;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (380, '2026-10-21', 3300, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3300, sellCostBuyPrice =sellCostBuyPrice-2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 3300, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3300, sellCostBuyPrice =sellCostBuyPrice-2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-21 15:54:41' WHERE storedetailid = '380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('380', '1', '2', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '6', '8', '1', '2026-10-11 20:54:37','0','0'); -- id=5132
UPDATE sellbilldetail SET  lastbuyprice = 1800.00 , meanbuyprice = 1800.00, lastbuyprice_withDiscount = 1800.00, meanbuyprice_withDiscount = 1800.00
        , lastbuyprice_withTax = 1800, meanbuyprice_withTax = 1800, lastbuyprice_withDiscountAndTax = 1800
                where sellbilldetailid = 2250;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (476, '2026-10-21', 4200, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4200, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 4200, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4200, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3600
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-21 15:54:42' WHERE storedetailid = '476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('476', '1', '2', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '5', '1', '2026-10-11 20:54:37','0','0'); -- id=5133
UPDATE sellbilldetail SET  lastbuyprice = 1250.00 , meanbuyprice = 1250.00, lastbuyprice_withDiscount = 1250.00, meanbuyprice_withDiscount = 1250.00
        , lastbuyprice_withTax = 1250, meanbuyprice_withTax = 1250, lastbuyprice_withDiscountAndTax = 1250
                where sellbilldetailid = 2251;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (470, '2026-10-21', 1690, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1690, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 1690, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1690, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-21 15:54:42' WHERE storedetailid = '470';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('470', '1', '1', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '4', '1', '2026-10-11 20:54:37','0','0'); -- id=5134
UPDATE sellbilldetail SET  lastbuyprice = 1450.00 , meanbuyprice = 1450.00, lastbuyprice_withDiscount = 1450.00, meanbuyprice_withDiscount = 1450.00
        , lastbuyprice_withTax = 1450, meanbuyprice_withTax = 1450, lastbuyprice_withDiscountAndTax = 1450
                where sellbilldetailid = 2252;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (468, '2026-10-21', 1700, 1450, 1450
                    , 1450, 1450, 1450, 1450
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1450, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1700, sellCostBuyPrice =sellCostBuyPrice-1450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1450, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1450
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 1700, 1450, 1450
                    , 1450, 1450, 1450, 1450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1450, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1700, sellCostBuyPrice =sellCostBuyPrice-1450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1450, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1450
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-21 15:54:42' WHERE storedetailid = '468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('468', '1', '1', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '5', '6', '1', '2026-10-11 20:54:37','0','0'); -- id=5135
UPDATE sellbilldetail SET  lastbuyprice = 1600.00 , meanbuyprice = 1600.00, lastbuyprice_withDiscount = 1600.00, meanbuyprice_withDiscount = 1600.00
        , lastbuyprice_withTax = 1600, meanbuyprice_withTax = 1600, lastbuyprice_withDiscountAndTax = 1600
                where sellbilldetailid = 2253;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (424, '2026-10-21', 3900, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3900, sellCostBuyPrice =sellCostBuyPrice-3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 3900, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3900, sellCostBuyPrice =sellCostBuyPrice-3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-21 15:54:42' WHERE storedetailid = '424';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('424', '1', '2', '0', '275', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '6', '1', '2026-10-11 20:54:37','0','0'); -- id=5136
CALL clientInUse(49,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-5000', userid = '1' WHERE clientid = '49';
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 ('49','2255.00','7255.00','1','تعديل فاتورة مبيعات','275', '-5000', '2026-10-11 20:54:37', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '17255', '0', null, '0', null, null,'', '0','1','1','7255','1','2026-10-11 20:54:37','0','0','',''); -- id=629
UPDATE client SET  inUse = 0 where clientid = 49;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-846878.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 ('-836878.1875','10000', '1', '1', 'تعديل فاتورة مبيعات', '275', '-846878.1875', '2026-10-21 15:54:42', '1',  'sellbillController.php','49','','0'); -- id=383
 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-21', 17255, 14250, 14250
                    , 14250, 14250, 14250, 14250
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14250, 14250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-17255, sellCostBuyPrice =sellCostBuyPrice-14250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14250
                        , returnSellVal = returnSellVal-0, 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 (49, '2026-10-21', 17255, 14250, 14250
                    , 14250, 14250, 14250, 14250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14250, 14250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-17255, sellCostBuyPrice =sellCostBuyPrice-14250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14250
                        , returnSellVal = returnSellVal-0, 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, 17255, 14250, 14250
                    , 14250, 14250, 14250, 14250, 14250, 14250)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-17255, netSellCostBuyPrice = netSellCostBuyPrice-14250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-14250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-14250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-14250
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-14250
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-14250
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-14250
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-14250;

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


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

COMMIT;
BEGIN;
CALL clientInUse(49,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-11 20:54:37', '06acbd92c6bd2f', '49', '-5000.00', '4275', '0', '1', '19275', '19275', '10000', '9275', '1', '2026-10-11 20:54:37', '', '1', '0', 'السيد الالفي ', '1', '1', '3', '0', 'السيد الالفي ', '14', '275', 'sellbillController', '0','','','','','-1','0','0','10000','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-11','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=367
UPDATE client SET  clientdebt = '4275', userid = '1' WHERE clientid = '49';
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 ('49','-5000.00','9275','0','اضافة فاتورة مبيعات (معدله)','367', '4275', '2026-10-21 15:54:43', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '19275', '0', null, '0', null, null,'', '0','1','1','7255','1','2026-10-11 20:54:37','0','0','',''); -- id=630
UPDATE client SET  inUse = 0 where clientid = 49;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1100','00473', '367', '16', '473', '1.00', '1495', '1495', '0', '', '1', '2026-10-21 15:54:43', '473', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1495','1495','0','','0','0.00','0','0','0','0'); -- id=2899
UPDATE sellbilldetail SET  lastbuyprice = 1100.00 , meanbuyprice = 1100.00, lastbuyprice_withDiscount = 1100.00, meanbuyprice_withDiscount = 1100.00
        , lastbuyprice_withTax = 1100, meanbuyprice_withTax = 1100, lastbuyprice_withDiscountAndTax = 1100
                where sellbilldetailid = 2899;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (473, '2026-10-21', 1495, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1495, sellCostBuyPrice =sellCostBuyPrice+1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1495, 1100, 1100
                    , 1100, 1100, 1100, 1100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1100, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1495, sellCostBuyPrice =sellCostBuyPrice+1100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-21 15:54:43' WHERE storedetailid = '473';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('473', '1', '1', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '4', '3', '1', '2026-10-21 15:54:43','0','0'); -- id=5137
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 32;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','00378', '367', '16', '378', '2.00', '485', '970', '0', '', '1', '2026-10-21 15:54:43', '378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','32-2,','1','1','0','0','485','970','0','','0','0.00','0','0','0','0'); -- id=2900
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 2900;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2026-10-21 15:54:44' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '23', '1', '2026-10-21 15:54:44','0','0'); -- id=5138
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 31;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1400','00380', '367', '16', '380', '2.00', '1650', '3300', '0', '', '1', '2026-10-21 15:54:44', '380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','31-2,','1','1','0','0','1650','3300','0','','0','0.00','0','0','0','0'); -- id=2901
UPDATE sellbilldetail SET  lastbuyprice = 1400.00 , meanbuyprice = 1400.00, lastbuyprice_withDiscount = 1400.00, meanbuyprice_withDiscount = 1400.00
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where sellbilldetailid = 2901;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (380, '2026-10-21', 3300, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 3300, 2800, 2800
                    , 2800, 2800, 2800, 2800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3300, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-21 15:54:44' WHERE storedetailid = '380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('380', '1', '2', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '6', '1', '2026-10-21 15:54:44','0','0'); -- id=5139
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1800','00476', '367', '16', '476', '2.00', '2100', '4200', '0', '', '1', '2026-10-21 15:54:44', '476', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2100','4200','0','','0','0.00','0','0','0','0'); -- id=2902
UPDATE sellbilldetail SET  lastbuyprice = 1800.00 , meanbuyprice = 1800.00, lastbuyprice_withDiscount = 1800.00, meanbuyprice_withDiscount = 1800.00
        , lastbuyprice_withTax = 1800, meanbuyprice_withTax = 1800, lastbuyprice_withDiscountAndTax = 1800
                where sellbilldetailid = 2902;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (476, '2026-10-21', 4200, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 4200, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-21 15:54:45' WHERE storedetailid = '476';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('476', '1', '2', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '3', '1', '2026-10-21 15:54:45','0','0'); -- id=5140
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1250','00470', '367', '16', '470', '1.00', '1690', '1690', '0', '', '1', '2026-10-21 15:54:45', '470', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1690','1690','0','','0','0.00','0','0','0','0'); -- id=2903
UPDATE sellbilldetail SET  lastbuyprice = 1250.00 , meanbuyprice = 1250.00, lastbuyprice_withDiscount = 1250.00, meanbuyprice_withDiscount = 1250.00
        , lastbuyprice_withTax = 1250, meanbuyprice_withTax = 1250, lastbuyprice_withDiscountAndTax = 1250
                where sellbilldetailid = 2903;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (470, '2026-10-21', 1690, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1690, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 1690, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1690, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-21 15:54:45' WHERE storedetailid = '470';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('470', '1', '1', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '4', '3', '1', '2026-10-21 15:54:45','0','0'); -- id=5141
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1450','00468', '367', '16', '468', '1.00', '1700', '1700', '0', '', '1', '2026-10-21 15:54:45', '468', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1700','1700','0','','0','0.00','0','0','0','0'); -- id=2904
UPDATE sellbilldetail SET  lastbuyprice = 1450.00 , meanbuyprice = 1450.00, lastbuyprice_withDiscount = 1450.00, meanbuyprice_withDiscount = 1450.00
        , lastbuyprice_withTax = 1450, meanbuyprice_withTax = 1450, lastbuyprice_withDiscountAndTax = 1450
                where sellbilldetailid = 2904;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (468, '2026-10-21', 1700, 1450, 1450
                    , 1450, 1450, 1450, 1450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1450, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1700, sellCostBuyPrice =sellCostBuyPrice+1450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 1700, 1450, 1450
                    , 1450, 1450, 1450, 1450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1450, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1700, sellCostBuyPrice =sellCostBuyPrice+1450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-21 15:54:45' WHERE storedetailid = '468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('468', '1', '1', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '5', '1', '2026-10-21 15:54:45','0','0'); -- id=5142
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1600','00424', '367', '16', '424', '2.00', '1950', '3900', '0', '', '1', '2026-10-21 15:54:45', '424', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1950','3900','0','','0','0.00','0','0','0','0'); -- id=2905
UPDATE sellbilldetail SET  lastbuyprice = 1600.00 , meanbuyprice = 1600.00, lastbuyprice_withDiscount = 1600.00, meanbuyprice_withDiscount = 1600.00
        , lastbuyprice_withTax = 1600, meanbuyprice_withTax = 1600, lastbuyprice_withDiscountAndTax = 1600
                where sellbilldetailid = 2905;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (424, '2026-10-21', 3900, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3900, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 3900, 3200, 3200
                    , 3200, 3200, 3200, 3200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3200, 3200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3900, sellCostBuyPrice =sellCostBuyPrice+3200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-21 15:54:45' WHERE storedetailid = '424';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('424', '1', '2', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '4', '1', '2026-10-21 15:54:45','0','0'); -- id=5143
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('850','00493', '367', '16', '493', '1', '1050', '1050', '0', '', '1', '2026-10-21 15:54:46', '493', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1050','1050','0','','0','0.00','0','0','0','0'); -- id=2906
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 850.00, meanbuyprice_withDiscount = 850.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 850
                where sellbilldetailid = 2906;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (493, '2026-10-21', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 1050, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-21 15:54:46' WHERE storedetailid = '493';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('493', '1', '1', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '4', '1', '2026-10-21 15:54:46','0','0'); -- id=5144
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 32;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','00378', '367', '16', '378', '2', '485', '970', '0', '', '1', '2026-10-21 15:54:46', '378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','32-2,','1','1','0','0','485','970','0','','0','0.00','0','0','0','0'); -- id=2907
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 2907;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (378, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 970, 850, 850
                    , 850, 850, 850, 850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 850, 850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+970, sellCostBuyPrice =sellCostBuyPrice+850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-21 15:54:46' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '2', '1', '367', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '23', '21', '1', '2026-10-21 15:54:46','0','0'); -- id=5145
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-836878.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 ('-846878.1875','10000', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '367', '-836878.1875', '2026-10-21 15:54:46', '1',  'sellbillController.php','49','','0'); -- id=384
UPDATE dailyentry SET totalcreditor = '17255.00', totaldebtor = '17255.00', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 21:21:00', entryComment = 'اضافة فاتورة مبيعات رقم 275', fromFlag = '1',related='0',isopeningentry='0',operationId='275',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=275' WHERE id = '1526';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17255.00', '17255.00', '2026-10-21', '1', '0', '1526', '2026-10-21 15:54:47','تم عكس القيد رقم 1526 ','1','0','0','0','0',''); -- id=1869
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1869', '482', '17255.00', '','0'); -- id=1873
UPDATE accountstree SET name = 'السيد الالفي ', customName = 'السيد الالفي ', customNameEn = 'السيد الالفي ', nameEn = 'السيد الالفي ', parent = '58', accountNature = '0', theValue = '-15000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:54:17' WHERE id = '482';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1869', '143', '17255.00', '','0'); -- id=1886
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1537092.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '10000.00', totaldebtor = '10000.00', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 21:21:00', entryComment = 'اضافة فاتورة مبيعات رقم 275 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='275',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=275' WHERE id = '1527';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000.00', '10000.00', '2026-10-21', '1', '0', '1527', '2026-10-21 15:54:47','تم عكس القيد رقم 1527 ','1','0','0','0','0',''); -- id=1870
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1870', '383', '10000.00', '','0'); -- id=1874
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '205072.09', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1870', '482', '10000.00', '','0'); -- id=1887
UPDATE accountstree SET name = 'السيد الالفي ', customName = 'السيد الالفي ', customNameEn = 'السيد الالفي ', nameEn = 'السيد الالفي ', parent = '58', accountNature = '0', theValue = '-5000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:54:17' WHERE id = '482';
UPDATE dailyentry SET totalcreditor = '14250.00', totaldebtor = '14250.00', thedate = '2026-10-11', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-11 21:21:00', entryComment = 'اضافة فاتورة مبيعات رقم 275 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='275',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=275' WHERE id = '1528';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14250.00', '14250.00', '2026-10-21', '1', '0', '1528', '2026-10-21 15:54:48','تم عكس القيد رقم 1528 ','1','0','0','0','0',''); -- id=1871
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1871', '402', '14250.00', '','0'); -- id=1875
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1374306.05', 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 ('1871', '382', '14250.00', '','0'); -- id=1888
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2195581.45', 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 ( '19275', '19275', '2026-10-21', '1', '0', '0', '2026-10-21 15:54:48','اضافة فاتورة مبيعات رقم 367','1','0',null,'0','367','sellbillController.php?do=showDetail&sellbillid=367'); -- id=1872
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1872', '482', '19275', '','0'); -- id=1889
UPDATE accountstree SET name = 'السيد الالفي ', customName = 'السيد الالفي ', customNameEn = 'السيد الالفي ', nameEn = 'السيد الالفي ', parent = '58', accountNature = '0', theValue = '14275', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:54:17' WHERE id = '482';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1872', '143', '19275', '','0'); -- id=1876
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1556367.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-10-21', '1', '0', '0', '2026-10-21 15:54:48','اضافة فاتورة مبيعات رقم 367 - تحصيل الفاتورة من العميل','1','0',null,'0','367','sellbillController.php?do=showDetail&sellbillid=367'); -- id=1873
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1873', '383', '10000', '','0'); -- id=1890
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '215072.09', 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 ('1873', '482', '10000', '','0'); -- id=1877
UPDATE accountstree SET name = 'السيد الالفي ', customName = 'السيد الالفي ', customNameEn = 'السيد الالفي ', nameEn = 'السيد الالفي ', parent = '58', accountNature = '0', theValue = '4275', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:54:17' WHERE id = '482';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15950', '15950', '2026-10-21', '1', '0', '0', '2026-10-21 15:54:48','اضافة فاتورة مبيعات رقم 367 - صرف البضاعة من المخزن','1','0',null,'0','367','sellbillController.php?do=showDetail&sellbillid=367'); -- id=1874
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1874', '402', '15950', '','0'); -- id=1891
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1390256.05', 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 ('1874', '382', '15950', '','0'); -- id=1878
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2179631.45', 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='1872,1873,1874' where sellbillid=367;
 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-21', 19275, 15950, 15950
                    , 15950, 15950, 15950, 15950
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15950, 15950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19275, sellCostBuyPrice =sellCostBuyPrice+15950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15950
                        , returnSellVal = returnSellVal+0, 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 (49, '2026-10-21', 19275, 15950, 15950
                    , 15950, 15950, 15950, 15950
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15950, 15950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19275, sellCostBuyPrice =sellCostBuyPrice+15950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15950
                        , returnSellVal = returnSellVal+0, 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, 19275, 15950, 15950
                    , 15950, 15950, 15950, 15950, 15950, 15950)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19275, netSellCostBuyPrice = netSellCostBuyPrice+15950
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15950
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15950
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15950
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15950
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15950
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15950
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+15950;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 275 and newid=367 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:24:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:54:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:54:50', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=367'); -- id=4817
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:29:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 15:59:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 15:59:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:30:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:00:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 16:00:06', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4819
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:30:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-21 16:00:27', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4820
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:30:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:00:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:00:37', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4821
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:30:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:00:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:00:58', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4822
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 ('06ad8c58791aaa', '2026-10-21 16:00:39', '1', '81528.92', '81528.92', '0', '0', '2400.00',  '2400.00', '2400', '0', '1', '2026-10-21 16:00:58', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=65
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 ('00456', '65', '3', '456', '1', '2400', '2400.00', '0', '', '2026-10-21 16:00:58', '456','','','0','0','0','0','0',null,'2400','2400','0','0','0','0','0','0','0','0','1'); -- id=242
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 16:00:39', 1, 456, 0, 0
                    , 2400, 1, 0, 0, 1, '2026-10-21 16:00:59')
                ON DUPLICATE KEY UPDATE buyprice = 2400,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 16:00:59' ; -- id=242
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('456', '2400', '1', '0', 'buyBillController.php', '242', '', '0', '0'); -- id=242
UPDATE product SET  productBuyPrice = "2400" WHERE productId = 456 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 242 ;
UPDATE product SET productName = 'لوحه 36 خط بالعمومي ', productDescription = '', productCatId = '3', productBuyPrice = '2400.00', productSellAllPrice = '2500.00', productSellUnitPrice = '2530.00', productSellHalfPrice = '2500.00', productDate = '2026-09-24', conditions = '0', userId = '1', limitamount = '0', parcode = '00456',type ='0', expireDate = '0' , dailyentryId = '823',isService = '0',isOptic = '0',lastbuyprice = '2400',lastbuyprice_withDiscount = '2400',meanbuyprice = '2400',meanbuyprice_withDiscount = '2400' , productbuypricereal = '2400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.17' , buyhalf_precentage = '4.17' , buypart_precentage = '5.42',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2400',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='2400',meanbuyprice_withTax='2400',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='2400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '456';
UPDATE buybilldetail SET  lastbuyprice = 2400 , meanbuyprice = 2400, lastbuyprice_withDiscount = 2400, meanbuyprice_withDiscount = 2400
        , lastbuyprice_withTax = 2400, meanbuyprice_withTax = 2400, lastbuyprice_withDiscountAndTax = 2400
                where buybilldetailid = 242;
UPDATE productunit SET proUnitBuyPrice  = 2400 * productnumber WHERE productid = 456;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '456';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('456', '1', '1', '0', '65', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '1', '2026-10-21 16:00:39','0','0'); -- id=5146
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-21 16:00:58'   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', 'اضافة فاتورة مشتريات', '65', '81528.92', '2026-10-21 16:00:39', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=111
UPDATE save SET  savecurrentvalue = '-839278.19',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-836878.19','2400', '1', '1', 'اضافة فاتورة مشتريات', '65', '-839278.19', '2026-10-21 16:00:39', '1',  'buyBillController.php','0','','0'); -- id=385
update buybill set dailyentryid='0,0' where buybillid=65;
COMMIT;
UPDATE product SET overAllAveragePrice = 2400 WHERE productId = 456;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:31:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:01:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:01:00', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=65'); -- id=4823
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:50:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:20:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:20:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4824
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:54:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:24:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:24:23', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4825

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad8ca18e6d74
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(37,@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-21 16:24:23', '06ad8ca18e6d74', '37', '0.00', '2300', '0', '1', '2300.00', '2300', '0', '2300', '1', '2026-10-21 16:24:23', '', '1', '0', 'محمد الجبالي ', '1', '1', '3', '0', '37 - محمد الجبالي ', '2' ,'0','','','','','-1','0','0','0','0','0','2300','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-21','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=368
UPDATE client SET  clientdebt = '2300', userid = '1' WHERE clientid = '37';
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 ('37','0.00','2300','0','اضافة فاتورة مبيعات','368', '2300', '2026-10-21 16:24:24', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2300', '0', null, '0', null, null,'', '0','1','1','2300','1','2026-10-21 16:24:23','0','0','',''); -- id=631
UPDATE client SET  inUse = 0 where clientid = 37;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','00262', '368', '10', '262', '1', '650', '650', '0', '', '1', '2026-10-21 16:24:24', '262', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','650','650','0','','0','0.00','0','0','0','0'); -- id=2908
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 2908;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (262, '2026-10-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+650, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+650, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-2', userid = '1', storedetaildate = '2026-10-21 16:24:24' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '1', '1', '368', 'اضافة فاتورة مبيعات', 'sellbillController.php', '-1', '-2', '1', '2026-10-21 16:24:24','0','0'); -- id=5147
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 114;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1350','00230', '368', '10', '230', '1', '1650', '1650', '0', '', '1', '2026-10-21 16:24:24', '230', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','114-1,','1','1','0','0','1650','1650','0','','0','0.00','0','0','0','0'); -- id=2909
UPDATE sellbilldetail SET  lastbuyprice = 1350.00 , meanbuyprice = 1336.36, lastbuyprice_withDiscount = 1350.00, meanbuyprice_withDiscount = 1336.36
        , lastbuyprice_withTax = 1350, meanbuyprice_withTax = 1336.36, lastbuyprice_withDiscountAndTax = 1350
                where sellbilldetailid = 2909;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (230, '2026-10-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.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+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-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.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 = '7', userid = '1', storedetaildate = '2026-10-21 16:24:24' WHERE storedetailid = '230';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '1', '1', '1', '368', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '7', '1', '2026-10-21 16:24:24','0','0'); -- id=5148
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2300', '2300', '2026-10-21', '1', '0', '0', '2026-10-21 16:24:24','اضافة فاتورة مبيعات رقم 368','1','0',null,'0','368','sellbillController.php?do=showDetail&sellbillid=368'); -- id=1875
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1875', '469', '2300', '','0'); -- id=1892
UPDATE accountstree SET name = 'محمد الجبالي ', customName = 'محمد الجبالي ', customNameEn = 'محمد الجبالي ', nameEn = 'محمد الجبالي ', parent = '58', accountNature = '0', theValue = '2300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-24 10:20:19' WHERE id = '469';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1875', '143', '2300', '','0'); -- id=1879
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1558667.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1930', '1930', '2026-10-21', '1', '0', '0', '2026-10-21 16:24:24','اضافة فاتورة مبيعات رقم 368 - صرف البضاعة من المخزن','1','0',null,'0','368','sellbillController.php?do=showDetail&sellbillid=368'); -- id=1876
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1876', '402', '1930', '','0'); -- id=1893
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1392186.05', 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 ('1876', '382', '1930', '','0'); -- id=1880
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2177701.45', 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='1875,0,1876' where sellbillid=368;
 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-21', 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1930, 1916.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, sellCostBuyPrice =sellCostBuyPrice+1930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1916.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1916.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1916.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (37, '2026-10-21', 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1930, 1916.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2300, sellCostBuyPrice =sellCostBuyPrice+1930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1916.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1916.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1916.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930, 1930, 1916.36)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2300, netSellCostBuyPrice = netSellCostBuyPrice+1930
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1930
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1916.36
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1930
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1916.36
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1930
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1930
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1916.36;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad8ca18e6d74 and sellbillId = 368 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 12:54:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:24:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:24:26', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4826
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:05:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:35:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:35:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4827
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:05:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:35:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:35:10', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4828
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:05:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:35:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:35:21', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=368'); -- id=4829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:05:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:35:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 16:35:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4830
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:06:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:36:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 16:36:53', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4831
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لوحه 6 خط الوسام ','','6','77.6','80','90','80','2026-10-21','0','1','0','','0','0','0','0','0','77.6','77.6','77.6','77.6','77.6','0','3.09','3.09','15.98','.','0','0','0','77.6','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','77.6','77.6','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','77.6','0','0','0','0','0','0','','','0','0','0','0'); -- id=615
UPDATE product SET productName = 'لوحه 6 خط الوسام ', productDescription = '', productCatId = '6', productBuyPrice = '77.6', productSellAllPrice = '80', productSellUnitPrice = '90', productSellHalfPrice = '80', productDate = '2026-10-21', conditions = '0', userId = '1', limitamount = '0', parcode = '00615',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '77.6',lastbuyprice_withDiscount = '77.6',meanbuyprice = '77.6',meanbuyprice_withDiscount = '77.6' , productbuypricereal = '77.6' , buypricereal_precentage = '0' , buytotal_precentage = '3.09' , buyhalf_precentage = '3.09' , buypart_precentage = '15.98',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='77.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='77.6',meanbuyprice_withTax='77.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='77.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 = '615';
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', '615', '1.00', '2026-10-21', '1', '0','0061501','80','80','90','77.6','','0','0','0','0','0','0','0','0','0','0'); -- id=615
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('615', '1', '8', '1', '2026-10-21'); -- id=615
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('615', '1', '8', '0', '615', 'إضافة منتج', 'productController.php', '0', '8', '1', '2026-10-21','0','0'); -- id=5149
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (615, 1,'2026-10-21 16:36:54',1)
                ON DUPLICATE KEY UPDATE productid = 615, edited = 1, sysdate = '2026-10-21 16:36:54', userid = 1; -- id=830
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '620.8', '620.8', '2026-10-21', '1', '0', '0', '2026-10-21 16:36:54','إضافة منتج لوحه 6 خط الوسام  الكمية 8','1','0','0','0','615','productController.php?do=edit&id=615'); -- id=1877
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1877', '382', '620.8', '','0'); -- id=1894
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2178322.25', 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 ('1877', '121', '620.8', '','0'); -- id=1881
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1872030.07', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لوحه 6 خط الوسام ', productDescription = '', productCatId = '6', productBuyPrice = '77.60', productSellAllPrice = '80.00', productSellUnitPrice = '90.00', productSellHalfPrice = '80.00', productDate = '2026-10-21', conditions = '0', userId = '1', limitamount = '0', parcode = '00615',type ='0', expireDate = '0' , dailyentryId = '1877',isService = '0',isOptic = '0',lastbuyprice = '77.6',lastbuyprice_withDiscount = '77.6',meanbuyprice = '77.6',meanbuyprice_withDiscount = '77.6' , productbuypricereal = '77.6' , buypricereal_precentage = '0' , buytotal_precentage = '3.09' , buyhalf_precentage = '3.09' , buypart_precentage = '15.98',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='77.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='77.6',meanbuyprice_withTax='77.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='77.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 = '615';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:06:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:36:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 16:36:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4832
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:07:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:37:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:37:13', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4833
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 368;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 16:37:13', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '368';
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 2908;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (262, '2026-10-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-650, sellCostBuyPrice =sellCostBuyPrice-580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-580, sellCostMeanBuyPrice = sellCostMeanBuyPrice-580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-580
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-650, sellCostBuyPrice =sellCostBuyPrice-580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-580, sellCostMeanBuyPrice = sellCostMeanBuyPrice-580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-580
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '-1', userid = '1', storedetaildate = '2026-10-21 16:37:13' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '1', '0', '368', 'تعديل فاتورة مبيعات', 'sellbillController.php', '-2', '-1', '1', '2026-10-21 16:24:23','0','0'); -- id=5150
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 114;
UPDATE sellbilldetail SET  lastbuyprice = 1350.00 , meanbuyprice = 1336.36, lastbuyprice_withDiscount = 1350.00, meanbuyprice_withDiscount = 1336.36
        , lastbuyprice_withTax = 1350, meanbuyprice_withTax = 1336.36, lastbuyprice_withDiscountAndTax = 1350
                where sellbilldetailid = 2909;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (230, '2026-10-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1650, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1336.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-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-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1650, sellCostBuyPrice =sellCostBuyPrice-1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1336.36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-21 16:37:13' WHERE storedetailid = '230';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '1', '1', '0', '368', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '8', '1', '2026-10-21 16:24:23','0','0'); -- id=5151
CALL clientInUse(37,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '37';
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 ('37','2300.00','2300.00','1','تعديل فاتورة مبيعات','368', '0', '2026-10-21 16:24:23', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2300', '0', null, '0', null, null,'', '0','1','1','2300','1','2026-10-21 16:24:23','0','0','',''); -- id=632
UPDATE client SET  inUse = 0 where clientid = 37;
 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-21', 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1930, 1916.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2300, sellCostBuyPrice =sellCostBuyPrice-1930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1930, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1916.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1916.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1916.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (37, '2026-10-21', 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1930, 1916.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2300, sellCostBuyPrice =sellCostBuyPrice-1930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1930, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1916.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1916.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1916.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2300, 1930, 1930
                    , 1916.36, 1930, 1916.36, 1930, 1930, 1916.36)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2300, netSellCostBuyPrice = netSellCostBuyPrice-1930
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-1930
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-1916.36
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-1930
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-1916.36
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-1930
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-1930
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-1916.36;

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


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

COMMIT;
BEGIN;
CALL clientInUse(37,@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-21 16:24:23', '06ad8ca18e6d74', '37', '0.00', '2390', '0', '1', '2390', '2390', '0', '2390', '1', '2026-10-21 16:24:23', '', '1', '0', 'محمد الجبالي ', '1', '1', '3', '0', '37 - محمد الجبالي ', '3', '368', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-21','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=369
UPDATE client SET  clientdebt = '2390', userid = '1' WHERE clientid = '37';
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 ('37','0.00','2390','0','اضافة فاتورة مبيعات (معدله)','369', '2390', '2026-10-21 16:37:14', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2390', '0', null, '0', null, null,'', '0','1','1','2300','1','2026-10-21 16:24:23','0','0','',''); -- id=633
UPDATE client SET  inUse = 0 where clientid = 37;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','00262', '369', '10', '262', '1.00', '650', '650', '0', '', '1', '2026-10-21 16:37:14', '262', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','650','650','0','','0','0.00','0','0','0','0'); -- id=2910
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 2910;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (262, '2026-10-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+650, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 650, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+650, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-2', userid = '1', storedetaildate = '2026-10-21 16:37:15' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '1', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '-1', '-2', '1', '2026-10-21 16:37:15','0','0'); -- id=5152
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 114;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1350','00230', '369', '10', '230', '1.00', '1650', '1650', '0', '', '1', '2026-10-21 16:37:15', '230', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','114-1,','1','1','0','0','1650','1650','0','','0','0.00','0','0','0','0'); -- id=2911
UPDATE sellbilldetail SET  lastbuyprice = 1350.00 , meanbuyprice = 1336.36, lastbuyprice_withDiscount = 1350.00, meanbuyprice_withDiscount = 1336.36
        , lastbuyprice_withTax = 1350, meanbuyprice_withTax = 1336.36, lastbuyprice_withDiscountAndTax = 1350
                where sellbilldetailid = 2911;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (230, '2026-10-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.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+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-21', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.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 = '7', userid = '1', storedetaildate = '2026-10-21 16:37:15' WHERE storedetailid = '230';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '1', '1', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '7', '1', '2026-10-21 16:37:15','0','0'); -- id=5153
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77.6','00615', '369', '6', '615', '1', '90', '90', '0', '', '1', '2026-10-21 16:37:15', '615', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90','90','0','','0','0.00','0','0','0','0'); -- id=2912
UPDATE sellbilldetail SET  lastbuyprice = 77.60 , meanbuyprice = 77.60, lastbuyprice_withDiscount = 77.60, meanbuyprice_withDiscount = 77.60
        , lastbuyprice_withTax = 77.6, meanbuyprice_withTax = 77.6, lastbuyprice_withDiscountAndTax = 77.6
                where sellbilldetailid = 2912;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (615, '2026-10-21', 90, 77.6, 77.6
                    , 77.6, 77.6, 77.6, 77.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77.6, 77.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+77.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 90, 77.6, 77.6
                    , 77.6, 77.6, 77.6, 77.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.6, 77.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+77.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-21 16:37:16' WHERE storedetailid = '615';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('615', '1', '1', '1', '369', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '7', '1', '2026-10-21 16:37:16','0','0'); -- id=5154
UPDATE dailyentry SET totalcreditor = '2300.00', totaldebtor = '2300.00', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 16:24:24', entryComment = 'اضافة فاتورة مبيعات رقم 368', fromFlag = '1',related='0',isopeningentry='0',operationId='368',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=368' WHERE id = '1875';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2300.00', '2300.00', '2026-10-21', '1', '0', '1875', '2026-10-21 16:37:16','تم عكس القيد رقم 1875 ','1','0','0','0','0',''); -- id=1878
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1878', '469', '2300.00', '','0'); -- id=1882
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-24 10:20:19' WHERE id = '469';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1878', '143', '2300.00', '','0'); -- id=1895
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1556367.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '1930.00', totaldebtor = '1930.00', thedate = '2026-10-21', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-21 16:24:24', entryComment = 'اضافة فاتورة مبيعات رقم 368 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='368',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=368' WHERE id = '1876';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1930.00', '1930.00', '2026-10-21', '1', '0', '1876', '2026-10-21 16:37:16','تم عكس القيد رقم 1876 ','1','0','0','0','0',''); -- id=1879
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1879', '402', '1930.00', '','0'); -- id=1883
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1390256.05', 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 ('1879', '382', '1930.00', '','0'); -- id=1896
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180252.25', 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 ( '2390', '2390', '2026-10-21', '1', '0', '0', '2026-10-21 16:37:17','اضافة فاتورة مبيعات رقم 369','1','0',null,'0','369','sellbillController.php?do=showDetail&sellbillid=369'); -- id=1880
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1880', '469', '2390', '','0'); -- id=1897
UPDATE accountstree SET name = 'محمد الجبالي ', customName = 'محمد الجبالي ', customNameEn = 'محمد الجبالي ', nameEn = 'محمد الجبالي ', parent = '58', accountNature = '0', theValue = '2390', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-24 10:20:19' WHERE id = '469';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1880', '143', '2390', '','0'); -- id=1884
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1558757.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2007.6', '2007.6', '2026-10-21', '1', '0', '0', '2026-10-21 16:37:17','اضافة فاتورة مبيعات رقم 369 - صرف البضاعة من المخزن','1','0',null,'0','369','sellbillController.php?do=showDetail&sellbillid=369'); -- id=1881
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1881', '402', '2007.6', '','0'); -- id=1898
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1392263.65', 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 ('1881', '382', '2007.6', '','0'); -- id=1885
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2178244.65', 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='1880,0,1881' where sellbillid=369;
 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-21', 2390, 2007.6, 2007.6
                    , 1993.96, 2007.6, 1993.96, 2007.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2007.6, 1993.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2390, sellCostBuyPrice =sellCostBuyPrice+2007.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2007.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1993.96
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2007.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1993.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2007.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2007.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1993.96
                        , returnSellVal = returnSellVal+0, 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 (37, '2026-10-21', 2390, 2007.6, 2007.6
                    , 1993.96, 2007.6, 1993.96, 2007.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2007.6, 1993.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2390, sellCostBuyPrice =sellCostBuyPrice+2007.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2007.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1993.96
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2007.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1993.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2007.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2007.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1993.96
                        , returnSellVal = returnSellVal+0, 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, 2390, 2007.6, 2007.6
                    , 1993.96, 2007.6, 1993.96, 2007.6, 2007.6, 1993.96)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2390, netSellCostBuyPrice = netSellCostBuyPrice+2007.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2007.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1993.96
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2007.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1993.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2007.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2007.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1993.96;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 368 and newid=369 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:07:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:37:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 16:37:18', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=369'); -- id=4834
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:29:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:59:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:59:05', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4835
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:29:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:59:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:59:27', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4836
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 ('06ad8d33a32cd9', '2026-10-21 16:59:06', '1', '81528.92', '81528.92', '0', '0', '2320.00',  '2320.00', '2320', '0', '1', '2026-10-21 16:59:27', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=66
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 ('00262', '66', '10', '262', '4', '580', '2320.00', '0', '', '2026-10-21 16:59:27', '262','','','0','0','0','0','0',null,'580','2320','0','0','0','0','0','0','0','0','1'); -- id=243
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 16:59:06', 1, 262, 0, 0
                    , 580, 4, 0, 0, 1, '2026-10-21 16:59:27')
                ON DUPLICATE KEY UPDATE buyprice = 580,
                        buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 16:59:27' ; -- id=243
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('262', '580', '4', '0', 'buyBillController.php', '243', '', '0', '0'); -- id=243
UPDATE product SET  productBuyPrice = "580" WHERE productId = 262 ;
UPDATE buybilldetail SET  quantitybefore = -2 WHERE buybilldetailid = 243 ;
UPDATE product SET productName = 'لفه ترمو 2 ملي الشرق ', productDescription = '', productCatId = '10', productBuyPrice = '580.00', productSellAllPrice = '620.00', productSellUnitPrice = '650.00', productSellHalfPrice = '620.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00262',type ='0', expireDate = '0' , dailyentryId = '310',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.90' , buyhalf_precentage = '6.90' , buypart_precentage = '12.07',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',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='580',meanbuyprice_withTax='580',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='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '262';
UPDATE buybilldetail SET  lastbuyprice = 580 , meanbuyprice = 580, lastbuyprice_withDiscount = 580, meanbuyprice_withDiscount = 580
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where buybilldetailid = 243;
UPDATE productunit SET proUnitBuyPrice  = 580 * productnumber WHERE productid = 262;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '4', '0', '66', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-2', '2', '1', '2026-10-21 16:59:06','0','0'); -- id=5155
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-21 16:59:27'   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', 'اضافة فاتورة مشتريات', '66', '81528.92', '2026-10-21 16:59:06', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=112
UPDATE save SET  savecurrentvalue = '-841598.19',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-839278.19','2320', '1', '1', 'اضافة فاتورة مشتريات', '66', '-841598.19', '2026-10-21 16:59:06', '1',  'buyBillController.php','0','','0'); -- id=386
update buybill set dailyentryid='0,0' where buybillid=66;
COMMIT;
UPDATE product SET overAllAveragePrice = 580 WHERE productId = 262;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:29:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 16:59:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 16:59:29', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=66'); -- id=4837
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:33:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:03:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 17:03:04', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4838
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('اسطوانه صاروخ ','','6','115','125','125','125','2026-10-21','0','1','0','','0','0','0','0','0','115','115','115','115','115','0','8.7','8.7','8.7','.','0','0','0','115','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','115','115','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','115','0','0','0','0','0','0','','','0','0','0','0'); -- id=616
UPDATE product SET productName = 'اسطوانه صاروخ ', productDescription = '', productCatId = '6', productBuyPrice = '115', productSellAllPrice = '125', productSellUnitPrice = '125', productSellHalfPrice = '125', productDate = '2026-10-21', conditions = '0', userId = '1', limitamount = '0', parcode = '00616',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '115',lastbuyprice_withDiscount = '115',meanbuyprice = '115',meanbuyprice_withDiscount = '115' , productbuypricereal = '115' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '8.7' , buypart_precentage = '8.7',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='115',meanbuyprice_withTax='115',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='115',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '616';
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', '616', '1.00', '2026-10-21', '1', '0','0061601','125','125','125','115','','0','0','0','0','0','0','0','0','0','0'); -- id=616
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('616', '1', '2', '1', '2026-10-21'); -- id=616
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('616', '1', '2', '0', '616', 'إضافة منتج', 'productController.php', '0', '2', '1', '2026-10-21','0','0'); -- id=5156
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (616, 1,'2026-10-21 17:03:05',1)
                ON DUPLICATE KEY UPDATE productid = 616, edited = 1, sysdate = '2026-10-21 17:03:05', userid = 1; -- id=831
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '230', '230', '2026-10-21', '1', '0', '0', '2026-10-21 17:03:05','إضافة منتج اسطوانه صاروخ  الكمية 2','1','0','0','0','616','productController.php?do=edit&id=616'); -- id=1882
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1882', '382', '230', '','0'); -- id=1899
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2178474.65', 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 ('1882', '121', '230', '','0'); -- id=1886
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1872260.07', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'اسطوانه صاروخ ', productDescription = '', productCatId = '6', productBuyPrice = '115.00', productSellAllPrice = '125.00', productSellUnitPrice = '125.00', productSellHalfPrice = '125.00', productDate = '2026-10-21', conditions = '0', userId = '1', limitamount = '0', parcode = '00616',type ='0', expireDate = '0' , dailyentryId = '1882',isService = '0',isOptic = '0',lastbuyprice = '115',lastbuyprice_withDiscount = '115',meanbuyprice = '115',meanbuyprice_withDiscount = '115' , productbuypricereal = '115' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '8.7' , buypart_precentage = '8.7',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='115',meanbuyprice_withTax='115',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='115',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '616';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:33:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:03:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 17:03:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:35:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:05:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:05:49', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4840

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad8c540b2cec
-- ----------------------------------------------------------------------------------------------------

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-21 17:05:50', '06ad8c540b2cec', '1', '0.00', '0', '0', '1', '11010.00', '11010', '11010', '0', '1', '2026-10-21 17:05:50', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '143' ,'0','','','','','-1','0','0','0','0','0','11010','0','','0','0','11010','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-21','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=370
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','اضافة فاتورة مبيعات','370', '0', '2026-10-21 17:05:50', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '11010', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-21 17:05:50','0','0','',''); -- id=634
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 242;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2400','00456', '370', '3', '456', '1', '2550', '2550', '0', '', '1', '2026-10-21 17:05:50', '456', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','242-1,','1','1','0','0','2550','2550','0','','0','0.00','0','0','0','0'); -- id=2913
UPDATE sellbilldetail SET  lastbuyprice = 2400.00 , meanbuyprice = 2400.00, lastbuyprice_withDiscount = 2400.00, meanbuyprice_withDiscount = 2400.00
        , lastbuyprice_withTax = 2400, meanbuyprice_withTax = 2400, lastbuyprice_withDiscountAndTax = 2400
                where sellbilldetailid = 2913;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (456, '2026-10-21', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-21 17:05:51' WHERE storedetailid = '456';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('456', '1', '1', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-21 17:05:51','0','0'); -- id=5157
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 105;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('960','00522', '370', '6', '522', '1', '975', '975', '0', '', '1', '2026-10-21 17:05:51', '522', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','105-1,','1','1','0','0','975','975','0','','0','0.00','0','0','0','0'); -- id=2914
UPDATE sellbilldetail SET  lastbuyprice = 934.40 , meanbuyprice = 945.23, lastbuyprice_withDiscount = 934.40, meanbuyprice_withDiscount = 945.23
        , lastbuyprice_withTax = 934.4, meanbuyprice_withTax = 945.23, lastbuyprice_withDiscountAndTax = 934.4
                where sellbilldetailid = 2914;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (522, '2026-10-21', 975, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 975, 934.4, 934.4
                    , 945.23, 934.4, 945.23, 947.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 934.4, 945.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+934.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+934.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+945.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+934.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+945.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+947.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+934.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+945.23
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2026-10-21 17:05:51' WHERE storedetailid = '522';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('522', '1', '1', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '23', '1', '2026-10-21 17:05:51','0','0'); -- id=5158
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+40 where id = 49;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.5','00432', '370', '20', '432', '40', '18.25', '730', '0', '', '1', '2026-10-21 17:05:51', '432', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','49-40,','1','1','0','0','18.25','730','0','','0','0.00','0','0','0','0'); -- id=2915
UPDATE sellbilldetail SET  lastbuyprice = 17.50 , meanbuyprice = 17.50, lastbuyprice_withDiscount = 17.50, meanbuyprice_withDiscount = 17.50
        , lastbuyprice_withTax = 17.5, meanbuyprice_withTax = 17.5, lastbuyprice_withDiscountAndTax = 17.5
                where sellbilldetailid = 2915;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (432, '2026-10-21', 730, 700, 700
                    , 700, 700, 700, 700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 700, 700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+730, sellCostBuyPrice =sellCostBuyPrice+700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 730, 700, 700
                    , 700, 700, 700, 700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 700, 700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+730, sellCostBuyPrice =sellCostBuyPrice+700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '232', userid = '1', storedetaildate = '2026-10-21 17:05:51' WHERE storedetailid = '432';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('432', '1', '40', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '272', '232', '1', '2026-10-21 17:05:51','0','0'); -- id=5159
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '370', '12', '385', '20', '9.8', '196', '0', '', '1', '2026-10-21 17:05:51', '385', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9.8','196','0','','0','0.00','0','0','0','0'); -- id=2916
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 = 2916;
 INSERT INTO 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-21', 196, 170, 170
                    , 170, 170, 170, 170
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 170, 170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+170
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+170
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 196, 170, 170
                    , 170, 170, 170, 170
                    , 0, 0, 0, 0
                    , 0, 0, 0, 170, 170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+170
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+170
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '302', userid = '1', storedetaildate = '2026-10-21 17:05:52' WHERE storedetailid = '385';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '1', '20', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '322', '302', '1', '2026-10-21 17:05:52','0','0'); -- id=5160
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.6','00585', '370', '12', '585', '20', '11.5', '230', '0', '', '1', '2026-10-21 17:05:52', '585', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.5','230','0','','0','0.00','0','0','0','0'); -- id=2917
UPDATE sellbilldetail SET  lastbuyprice = 10.60 , meanbuyprice = 10.60, lastbuyprice_withDiscount = 10.60, meanbuyprice_withDiscount = 10.60
        , lastbuyprice_withTax = 10.6, meanbuyprice_withTax = 10.6, lastbuyprice_withDiscountAndTax = 10.6
                where sellbilldetailid = 2917;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (585, '2026-10-21', 230, 212, 212
                    , 212, 212, 212, 212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 212, 212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 230, 212, 212
                    , 212, 212, 212, 212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 212, 212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2026-10-21 17:05:52' WHERE storedetailid = '585';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('585', '1', '20', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '110', '90', '1', '2026-10-21 17:05:52','0','0'); -- id=5161
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '370', '20', '388', '10', '5.25', '52.5', '0', '', '1', '2026-10-21 17:05:52', '388', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','25-10,','1','1','0','0','5.25','52.5','0','','0','0.00','0','0','0','0'); -- id=2918
UPDATE sellbilldetail SET  lastbuyprice = 4.83 , meanbuyprice = 4.82, lastbuyprice_withDiscount = 4.83, meanbuyprice_withDiscount = 4.82
        , lastbuyprice_withTax = 4.83, meanbuyprice_withTax = 4.82, lastbuyprice_withDiscountAndTax = 4.83
                where sellbilldetailid = 2918;
 INSERT INTO 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-21', 52.5, 48.3, 48.3
                    , 48.2, 48.3, 48.2, 48.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 48.3, 48.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+52.5, sellCostBuyPrice =sellCostBuyPrice+48.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+48.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+48.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+48.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+48.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+48.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+48.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+48.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 52.5, 48.3, 48.3
                    , 48.2, 48.3, 48.2, 48.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 48.3, 48.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+52.5, sellCostBuyPrice =sellCostBuyPrice+48.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+48.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+48.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+48.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+48.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+48.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+48.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+48.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2503', userid = '1', storedetaildate = '2026-10-21 17:05:52' WHERE storedetailid = '388';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('388', '1', '10', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2513', '2503', '1', '2026-10-21 17:05:52','0','0'); -- id=5162
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 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', '370', '12', '83', '5', '45', '225', '0', '', '1', '2026-10-21 17:05:52', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-5,','1','1','0','0','45','225','0','','0','0.00','0','0','0','0'); -- id=2919
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 = 2919;
 INSERT INTO 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-21', 225, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 225, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.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 = '218', userid = '1', storedetaildate = '2026-10-21 17:05:53' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '223', '218', '1', '2026-10-21 17:05:53','0','0'); -- id=5163
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 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', '370', '12', '82', '3', '34', '102', '0', '', '1', '2026-10-21 17:05:53', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2920
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 = 2920;
 INSERT INTO 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-21', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.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+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-21', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.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 = '265', userid = '1', storedetaildate = '2026-10-21 17:05:53' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '268', '265', '1', '2026-10-21 17:05:53','0','0'); -- id=5164
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '370', '12', '70', '10', '460', '4600', '0', '', '1', '2026-10-21 17:05:53', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','102-10,','1','1','0','0','460','4600','0','','0','0.00','0','0','0','0'); -- id=2921
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 364.21, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 364.21
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 364.21, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 2921;
 INSERT INTO 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-21', 4600, 4000, 4000
                    , 3642.1, 4000, 3642.1, 3630.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 4000, 3642.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4600, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3642.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3642.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3630.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3642.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 4600, 4000, 4000
                    , 3642.1, 4000, 3642.1, 3630.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 3642.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4600, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3642.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3642.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3630.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3642.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '1', storedetaildate = '2026-10-21 17:05:53' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '10', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '107', '97', '1', '2026-10-21 17:05:53','0','0'); -- id=5165
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.5','00419', '370', '6', '419', '1', '8', '8', '0', '', '1', '2026-10-21 17:05:53', '419', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','8','0','','0','0.00','0','0','0','0'); -- id=2922
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 2922;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-10-21', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-21 17:05:54' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28', '27', '1', '2026-10-21 17:05:54','0','0'); -- id=5166
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('82','00080', '370', '14', '80', '.5', '95', '47.5', '0', '', '1', '2026-10-21 17:05:54', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','47.5','0','','0','0.00','0','0','0','0'); -- id=2923
UPDATE sellbilldetail SET  lastbuyprice = 82.00 , meanbuyprice = 82.00, lastbuyprice_withDiscount = 82.00, meanbuyprice_withDiscount = 82.00
        , lastbuyprice_withTax = 82, meanbuyprice_withTax = 82, lastbuyprice_withDiscountAndTax = 82
                where sellbilldetailid = 2923;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-10-21', 47.5, 41, 41
                    , 41, 41, 41, 41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.5, 0, 41, 41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 47.5, 41, 41
                    , 41, 41, 41, 41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 41, 41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4.95', userid = '1', storedetaildate = '2026-10-21 17:05:54' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.5', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5.45', '4.95', '1', '2026-10-21 17:05:54','0','0'); -- id=5167
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('54','00374', '370', '14', '374', '.5', '60', '30', '0', '', '1', '2026-10-21 17:05:54', '374', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','60','30','0','','0','0.00','0','0','0','0'); -- id=2924
UPDATE sellbilldetail SET  lastbuyprice = 54.00 , meanbuyprice = 54.00, lastbuyprice_withDiscount = 54.00, meanbuyprice_withDiscount = 54.00
        , lastbuyprice_withTax = 54, meanbuyprice_withTax = 54, lastbuyprice_withDiscountAndTax = 54
                where sellbilldetailid = 2924;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (374, '2026-10-21', 30, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.5, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 30, 27, 27
                    , 27, 27, 27, 27
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 27, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+27
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+27, sellCostMeanBuyPrice = sellCostMeanBuyPrice+27
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+27
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+27
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19.25', userid = '1', storedetaildate = '2026-10-21 17:05:54' WHERE storedetailid = '374';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('374', '1', '0.5', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19.75', '19.25', '1', '2026-10-21 17:05:54','0','0'); -- id=5168
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6.5','00315', '370', '6', '315', '10', '8', '80', '0', '', '1', '2026-10-21 17:05:55', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','80','0','','0','0.00','0','0','0','0'); -- id=2925
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 2925;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-10-21', 80, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 80, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+80, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '568', userid = '1', storedetaildate = '2026-10-21 17:05:55' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '10', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '578', '568', '1', '2026-10-21 17:05:55','0','0'); -- id=5169
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.72','00182', '370', '20', '182', '10', '54.5', '545', '0', '', '1', '2026-10-21 17:05:55', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.5','545','0','','0','0.00','0','0','0','0'); -- id=2926
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 2926;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-21', 545, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+427.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-21', 545, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+427.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '819', userid = '1', storedetaildate = '2026-10-21 17:05:55' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '10', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '829', '819', '1', '2026-10-21 17:05:55','0','0'); -- id=5170
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 175;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00108', '370', '3', '108', '2', '103', '206', '0', '', '1', '2026-10-21 17:05:55', '108', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','175-2,','1','1','0','0','103','206','0','','0','0.00','0','0','0','0'); -- id=2927
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 2927;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (108, '2026-10-21', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 206, 202, 202
                    , 202, 202, 202, 202
                    , 0, 0, 0, 0
                    , 0, 0, 0, 202, 202, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+206, sellCostBuyPrice =sellCostBuyPrice+202
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+202, sellCostMeanBuyPrice = sellCostMeanBuyPrice+202
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+202, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+202
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+202
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+202
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+202
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-21 17:05:56' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '2', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29', '27', '1', '2026-10-21 17:05:56','0','0'); -- id=5171
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '370', '14', '81', '7', '19', '133', '0', '', '1', '2026-10-21 17:05:56', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','133','0','','0','0.00','0','0','0','0'); -- id=2928
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 = 2928;
 INSERT INTO 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-21', 133, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+133, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 133, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+133, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-21 17:05:56' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '7', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '41', '1', '2026-10-21 17:05:56','0','0'); -- id=5172
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00616', '370', '6', '616', '2', '150', '300', '0', '', '1', '2026-10-21 17:05:56', '616', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=2929
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 = 2929;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (616, '2026-10-21', 300, 230, 230
                    , 230, 230, 230, 230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 230, 230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 300, 230, 230
                    , 230, 230, 230, 230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 230, 230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-21 17:05:56' WHERE storedetailid = '616';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('616', '1', '2', '1', '370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '0', '1', '2026-10-21 17:05:56','0','0'); -- id=5173
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-830588.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 ('-841598.1875','11010', '0', '1', 'اضافة فاتورة مبيعات', '370', '-830588.1875', '2026-10-21 17:05:56', '1',  'sellbillController.php','1','','0'); -- id=387
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11010', '11010', '2026-10-21', '1', '0', '0', '2026-10-21 17:05:57','اضافة فاتورة مبيعات رقم 370','1','0',null,'0','370','sellbillController.php?do=showDetail&sellbillid=370'); -- id=1883
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1883', '383', '11010', '','0'); -- id=1900
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '226082.09', 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 ('1883', '143', '11010', '','0'); -- id=1887
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1569767.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9878.8', '9878.8', '2026-10-21', '1', '0', '0', '2026-10-21 17:05:57','اضافة فاتورة مبيعات رقم 370 - صرف البضاعة من المخزن','1','0',null,'0','370','sellbillController.php?do=showDetail&sellbillid=370'); -- id=1884
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1884', '402', '9878.8', '','0'); -- id=1901
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1402142.45', 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 ('1884', '382', '9878.8', '','0'); -- id=1888
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2168595.85', 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='1883,0,1884' where sellbillid=370;
 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-21', 11010, 9878.8, 9878.8
                    , 9538.13, 9878.8, 9538.13, 9522.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9878.8, 9538.13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11010, sellCostBuyPrice =sellCostBuyPrice+9878.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9878.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9538.13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9878.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9538.13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9522.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9878.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9538.13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 11010, 9878.8, 9878.8
                    , 9538.13, 9878.8, 9538.13, 9522.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9878.8, 9538.13, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11010, sellCostBuyPrice =sellCostBuyPrice+9878.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9878.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9538.13
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9878.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9538.13
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9522.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9878.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9538.13
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 11010, 9878.8, 9878.8
                    , 9538.13, 9878.8, 9538.13, 9522.3, 9878.8, 9538.13)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11010, netSellCostBuyPrice = netSellCostBuyPrice+9878.8
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9878.8
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9538.13
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9878.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9538.13
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9522.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9878.8
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9538.13;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad8c540b2cec and sellbillId = 370 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:35:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:05:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:05:58', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4841
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:46:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:16:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 17:16:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4842
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:47:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:17:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 17:17:16', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4843

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =635
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-21 17:17:16', userid = '1' WHERE clientid = '2';
UPDATE client SET  inUse = 0 where clientid = 2;
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 ('2','3000.64','3000.64','1','ايصال تحصيل (( قبض من عميل ))','635', '0', '2026-10-21 17:16:53', '1', 'clientPayedDeptController.php', '   ', '3000.64', '0', null, '0', null, null,'', '-1','1','1','3000.64','1','','66','0','','.'); -- id=635
UPDATE save SET  savecurrentvalue = '-827587.55',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-830588.19','3000.64', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '635', '-827587.55', '2026-10-21 17:17:16', '1',  'clientPayedDeptController.php','2','','0'); -- id=388
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3000.64', '3000.64', '2026-10-21', '1', '0', '0', '2026-10-21 17:17:17','اضافة ايصال سداد للعميل فؤاد الطوخي','1','0','0','0','635','clientPayedDeptController.php?do=show&id=635'); -- id=1885
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1885', '383', '3000.64', '','0'); -- id=1902
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '229082.73', 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 ('1885', '426', '3000.64', '','0'); -- id=1889
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-13 20:11:03' WHERE id = '426';
UPDATE clientdebtchange SET clientid = '2', clientdebtchangebefore = '3000.640', clientdebtchangeamount = '3000.640', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '635', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-21 17:16:53', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '3000.640',discount='', reciptid='0', dailyentryid = '1885',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='3000.64',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '635';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:47:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:17:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 17:17:18', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4844
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:47:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:17:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 17:17:19', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4845
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:48:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:18:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 17:18:36', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:48:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:18:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 17:18:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4847
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:49:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:19:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 17:19:21', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=4848
BEGIN;
CALL supplierInUse(5,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('5', '27035.00', '100', '1', 'ايصال دفع لمورد', '1', '26935', '2026-10-21 17:18:38', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','100','1','0','0','0','31',''); -- id=113
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '27035.00', supplierdebtchangeamount = '100', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '26935', supplierdebtchangedate = '2026-10-21 17:18:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='27035',debtchangamountInSupplierCurrency='100',debtchangafterInSupplierCurrency='26935', paySerialNo='31',tagids='' WHERE supplierdebtchangeid = '113';
UPDATE supplier SET  suppliercurrentDebt = '26935',suppliercurrentDebtInCurrency= '26935' , userid = '1', supplierdate = '2026-10-21 17:19:22'   WHERE supplierid = '5';
UPDATE supplier SET  inUse = 0 where supplierid = 5;
UPDATE save SET  savecurrentvalue = '-827687.55',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-827587.55','100', '1', '1', 'ايصال دفع لمورد', '113', '-827687.55', '2026-10-21 17:19:22', '1',  'supplierPayedDeptController.php','0','','0'); -- id=389
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100', '100', '2026-10-21', '1', '0', '0', '2026-10-21 17:19:22','ايصال دفع لمورد ( العيسوي حساب نشات ) ','1','0','0','0','113','supplierReportsController.php?do=show&id=113'); -- id=1886
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1886', '423', '100', '','0'); -- id=1903
UPDATE accountstree SET name = 'العيسوي حساب نشات', customName = 'العيسوي حساب نشات', customNameEn = 'العيسوي حساب نشات', nameEn = 'العيسوي حساب نشات', parent = '81', accountNature = '1', theValue = '26935', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-13 16:03:09' WHERE id = '423';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1886', '383', '100', '','0'); -- id=1890
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '228982.73', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '27035.00', supplierdebtchangeamount = '100.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '26935.00', supplierdebtchangedate = '2026-10-21 17:18:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1886',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='27035',debtchangamountInSupplierCurrency='100',debtchangafterInSupplierCurrency='26935', paySerialNo='31',tagids='' WHERE supplierdebtchangeid = '113';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:49:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:19:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 17:19:23', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=4849
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:49:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:19:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 17:19:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=4850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 13:49:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:19:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-21 17:19:26', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=4851
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:23:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:53:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:53:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4852
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:23:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:53:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:53:42', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4853
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:23:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:53:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:53:46', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=251'); -- id=4854
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:24:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:54:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:54:00', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4855
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 251;
UPDATE sellbill SET  sellbillsysdate = '2026-10-21 17:54:01', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '251';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 26;
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 = 2094;
 INSERT INTO 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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, sellCostBuyPrice =sellCostBuyPrice-430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, sellCostBuyPrice =sellCostBuyPrice-430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '342', userid = '1', storedetaildate = '2026-10-21 17:54:01' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '20', '0', '251', 'تعديل فاتورة مبيعات', 'sellbillController.php', '322', '342', '1', '2026-09-20 16:16:53','0','0'); -- id=5174
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 = 2095;
 INSERT INTO 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-21', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-21 17:54:01' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '251', 'تعديل فاتورة مبيعات', 'sellbillController.php', '41', '42', '1', '2026-09-20 16:16:53','0','0'); -- id=5175
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 2096;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (239, '2026-10-21', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-32, sellCostMeanBuyPrice = sellCostMeanBuyPrice-32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-32
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-36, sellCostBuyPrice =sellCostBuyPrice-32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-32, sellCostMeanBuyPrice = sellCostMeanBuyPrice-32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-32
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-21 17:54:01' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '2', '0', '251', 'تعديل فاتورة مبيعات', 'sellbillController.php', '35', '37', '1', '2026-09-20 16:16:53','0','0'); -- id=5176
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.00, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.00
        , lastbuyprice_withTax = 4, meanbuyprice_withTax = 4, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 2097;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (429, '2026-10-21', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-80, sellCostMeanBuyPrice = sellCostMeanBuyPrice-80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-80
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-80, sellCostMeanBuyPrice = sellCostMeanBuyPrice-80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-80
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-21 17:54:01' WHERE storedetailid = '429';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('429', '1', '20', '0', '251', 'تعديل فاتورة مبيعات', 'sellbillController.php', '40', '60', '1', '2026-09-20 16:16:53','0','0'); -- id=5177
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 26;
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 = 2098;
 INSERT INTO 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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, sellCostBuyPrice =sellCostBuyPrice-430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-600, sellCostBuyPrice =sellCostBuyPrice-430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-430, sellCostMeanBuyPrice = sellCostMeanBuyPrice-430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-430
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '362', userid = '1', storedetaildate = '2026-10-21 17:54:01' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '20', '0', '251', 'تعديل فاتورة مبيعات', 'sellbillController.php', '342', '362', '1', '2026-09-20 16:16:53','0','0'); -- id=5178
CALL clientInUse(20,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '20';
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 ('20','1375.00','1375.00','1','تعديل فاتورة مبيعات','251', '0', '2026-09-20 16:16:53', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '1375', '0', null, '0', null, null,'', '0','1','1','1375','1','2026-09-20 16:16:53','0','0','',''); -- id=636
UPDATE client SET  inUse = 0 where clientid = 20;
 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-21', 1375, 990, 990
                    , 990, 990, 990, 990
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,990, 990, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1375, sellCostBuyPrice =sellCostBuyPrice-990
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-990, sellCostMeanBuyPrice = sellCostMeanBuyPrice-990
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-990, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-990
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-990
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-990
                        , returnSellVal = returnSellVal-0, 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 (20, '2026-10-21', 1375, 990, 990
                    , 990, 990, 990, 990
                    , 0, 0, 0, 0
                    , 0, 0, 0, 990, 990, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1375, sellCostBuyPrice =sellCostBuyPrice-990
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-990, sellCostMeanBuyPrice = sellCostMeanBuyPrice-990
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-990, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-990
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-990
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-990
                        , returnSellVal = returnSellVal-0, 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, 1375, 990, 990
                    , 990, 990, 990, 990, 990, 990)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-1375, netSellCostBuyPrice = netSellCostBuyPrice-990
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-990
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-990
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-990
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-990
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-990
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-990
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-990;

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


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

COMMIT;
BEGIN;
CALL clientInUse(20,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-20 16:16:53', '06aafe90cee946', '20', '0.00', '1405', '0', '1', '1405', '1405', '0', '1405', '1', '2026-09-20 16:16:53', '', '1', '0', 'مرتضي كفر شرف', '1', '1', '3', '0', 'مرتضي كفر شرف', '64', '251', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=371
UPDATE client SET  clientdebt = '1405', userid = '1' WHERE clientid = '20';
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 ('20','0.00','1405','0','اضافة فاتورة مبيعات (معدله)','371', '1405', '2026-10-21 17:54:02', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '1405', '0', null, '0', null, null,'', '0','1','1','1375','1','2026-09-20 16:16:53','0','0','',''); -- id=637
UPDATE client SET  inUse = 0 where clientid = 20;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 26;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '371', '2', '168', '20.00', '30', '600', '0', '', '1', '2026-10-21 17:54:02', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','26-20,','1','1','0','0','30','600','0','','0','0.00','0','0','0','0'); -- id=2930
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 = 2930;
 INSERT INTO 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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '342', userid = '1', storedetaildate = '2026-10-21 17:54:03' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '20', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '362', '342', '1', '2026-10-21 17:54:03','0','0'); -- id=5179
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '371', '14', '81', '1.00', '19', '19', '0', '', '1', '2026-10-21 17:54:03', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=2931
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 = 2931;
 INSERT INTO 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-21', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-21 17:54:03' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '42', '41', '1', '2026-10-21 17:54:03','0','0'); -- id=5180
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16','00239', '371', '2', '239', '2.00', '18', '36', '0', '', '1', '2026-10-21 17:54:03', '239', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','18','36','0','','0','0.00','0','0','0','0'); -- id=2932
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 2932;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (239, '2026-10-21', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-21 17:54:03' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '2', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '37', '35', '1', '2026-10-21 17:54:03','0','0'); -- id=5181
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00429', '371', '10', '429', '20.00', '6', '120', '0', '', '1', '2026-10-21 17:54:03', '429', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6','120','0','','0','0.00','0','0','0','0'); -- id=2933
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.00, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.00
        , lastbuyprice_withTax = 4, meanbuyprice_withTax = 4, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 2933;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (429, '2026-10-21', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-21', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-10-21 17:54:04' WHERE storedetailid = '429';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('429', '1', '20', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '60', '40', '1', '2026-10-21 17:54:04','0','0'); -- id=5182
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 26;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 240;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '371', '2', '168', '20.00', '30', '600', '0', '', '1', '2026-10-21 17:54:04', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','26-10,240-10,','1','1','0','0','30','600','0','','0','0.00','0','0','0','0'); -- id=2934
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 = 2934;
 INSERT INTO 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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '322', userid = '1', storedetaildate = '2026-10-21 17:54:04' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '20', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '342', '322', '1', '2026-10-21 17:54:04','0','0'); -- id=5183
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 183;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.96','00292', '371', '24', '292', '1', '30', '30', '0', '', '1', '2026-10-21 17:54:04', '292', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','183-1,','1','1','0','0','30','30','0','','0','0.00','0','0','0','0'); -- id=2935
UPDATE sellbilldetail 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 sellbilldetailid = 2935;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (292, '2026-10-21', 30, 26.96, 26.96
                    , 26.46, 26.96, 26.46, 26.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 26.96, 26.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+26.96
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26.96, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26.96
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-21', 30, 26.96, 26.96
                    , 26.46, 26.96, 26.46, 26.96
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26.96, 26.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+26.96
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26.96, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26.96
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-21 17:54:04' WHERE storedetailid = '292';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '1', '1', '1', '371', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-10-21 17:54:05','0','0'); -- id=5184
UPDATE dailyentry SET totalcreditor = '1375.00', totaldebtor = '1375.00', thedate = '2026-10-08', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-08 20:59:53', entryComment = 'اضافة فاتورة مبيعات رقم 251', fromFlag = '1',related='0',isopeningentry='0',operationId='251',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=251' WHERE id = '1444';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1375.00', '1375.00', '2026-10-21', '1', '0', '1444', '2026-10-21 17:54:05','تم عكس القيد رقم 1444 ','1','0','0','0','0',''); -- id=1887
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1887', '449', '1375.00', '','0'); -- id=1891
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-20 16:13:39' WHERE id = '449';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1887', '143', '1375.00', '','0'); -- id=1904
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1568392.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '990.00', totaldebtor = '990.00', thedate = '2026-10-08', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-08 20:59:53', entryComment = 'اضافة فاتورة مبيعات رقم 251 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='251',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=251' WHERE id = '1445';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '990.00', '990.00', '2026-10-21', '1', '0', '1445', '2026-10-21 17:54:05','تم عكس القيد رقم 1445 ','1','0','0','0','0',''); -- id=1888
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1888', '402', '990.00', '','0'); -- id=1892
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1401152.45', 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 ('1888', '382', '990.00', '','0'); -- id=1905
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2169585.85', 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 ( '1405', '1405', '2026-10-21', '1', '0', '0', '2026-10-21 17:54:06','اضافة فاتورة مبيعات رقم 371','1','0',null,'0','371','sellbillController.php?do=showDetail&sellbillid=371'); -- id=1889
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1889', '449', '1405', '','0'); -- id=1906
UPDATE accountstree SET name = 'مرتضي كفر شرف', customName = 'مرتضي كفر شرف', customNameEn = 'مرتضي كفر شرف', nameEn = 'مرتضي كفر شرف', parent = '58', accountNature = '0', theValue = '1405', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 16:13:39' WHERE id = '449';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1889', '143', '1405', '','0'); -- id=1893
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1569797.6', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1016.96', '1016.96', '2026-10-21', '1', '0', '0', '2026-10-21 17:54:06','اضافة فاتورة مبيعات رقم 371 - صرف البضاعة من المخزن','1','0',null,'0','371','sellbillController.php?do=showDetail&sellbillid=371'); -- id=1890
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1890', '402', '1016.96', '','0'); -- id=1907
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1402169.41', 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 ('1890', '382', '1016.96', '','0'); -- id=1894
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2168568.89', 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='1889,0,1890' where sellbillid=371;
 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-21', 1405, 1016.96, 1016.96
                    , 1016.46, 1016.96, 1016.46, 1016.96
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1016.96, 1016.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1405, sellCostBuyPrice =sellCostBuyPrice+1016.96
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1016.96, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1016.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1016.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1016.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1016.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1016.96
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1016.46
                        , returnSellVal = returnSellVal+0, 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 (20, '2026-10-21', 1405, 1016.96, 1016.96
                    , 1016.46, 1016.96, 1016.46, 1016.96
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1016.96, 1016.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1405, sellCostBuyPrice =sellCostBuyPrice+1016.96
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1016.96, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1016.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1016.96, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1016.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1016.96
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1016.96
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1016.46
                        , returnSellVal = returnSellVal+0, 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, 1405, 1016.96, 1016.96
                    , 1016.46, 1016.96, 1016.46, 1016.96, 1016.96, 1016.46)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1405, netSellCostBuyPrice = netSellCostBuyPrice+1016.96
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1016.96
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1016.46
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1016.96
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1016.46
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1016.96
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1016.96
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1016.46;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 251 and newid=371 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:24:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:54:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:54:07', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=371'); -- id=4856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 14:24:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 17:54:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 17:54:14', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4857
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:06:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:36:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:36:07', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=4858
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:06:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:36:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:36:08', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4859
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:06:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:36:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:36:11', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4860
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:06:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:36:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:36:17', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4861
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:07:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:37:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-21 18:37:23', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4862
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:07:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:37:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-21 18:37:32', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4863
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:07:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:37:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:37:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4864
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:06', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4865

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =638
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(74,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-21 18:38:06', userid = '1' WHERE clientid = '74';
UPDATE client SET  inUse = 0 where clientid = 74;
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 ('74','2557.75','2557.75','1','ايصال تحصيل (( قبض من عميل ))','638', '0', '2026-10-21 18:37:52', '1', 'clientPayedDeptController.php', '   ', '2557.75', '0', null, '0', null, null,'', '-1','1','1','2557.75','1','','67','0','','.'); -- id=638
UPDATE save SET  savecurrentvalue = '-825129.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-827687.55','2557.75', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '638', '-825129.8', '2026-10-21 18:38:06', '1',  'clientPayedDeptController.php','74','','0'); -- id=390
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2557.75', '2557.75', '2026-10-21', '1', '0', '0', '2026-10-21 18:38:06','اضافة ايصال سداد للعميل مصطفي نشات ','1','0','0','0','638','clientPayedDeptController.php?do=show&id=638'); -- id=1891
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1891', '383', '2557.75', '','0'); -- id=1908
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '231540.48', 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 ('1891', '507', '2557.75', '','0'); -- id=1895
UPDATE accountstree SET name = 'مصطفي نشات ', customName = 'مصطفي نشات ', customNameEn = 'مصطفي نشات ', nameEn = 'مصطفي نشات ', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-20 15:46:52' WHERE id = '507';
UPDATE clientdebtchange SET clientid = '74', clientdebtchangebefore = '2557.750', clientdebtchangeamount = '2557.750', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '638', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-21 18:37:52', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '2557.750',discount='', reciptid='0', dailyentryid = '1891',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='2557.75',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '638';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:07', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4866
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:09', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4867
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:38:14', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:36', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:48', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4870

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =639
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(75,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-21 18:38:48', userid = '1' WHERE clientid = '75';
UPDATE client SET  inUse = 0 where clientid = 75;
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 ('75','275.00','275','1','ايصال تحصيل (( قبض من عميل ))','639', '0', '2026-10-21 18:38:36', '1', 'clientPayedDeptController.php', '   ', '275', '0', null, '0', null, null,'', '-1','1','1','275','1','','68','0','','.'); -- id=639
UPDATE save SET  savecurrentvalue = '-824854.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-825129.80','275', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '639', '-824854.8', '2026-10-21 18:38:48', '1',  'clientPayedDeptController.php','75','','0'); -- id=391
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '275', '275', '2026-10-21', '1', '0', '0', '2026-10-21 18:38:49','اضافة ايصال سداد للعميل محمد حسن','1','0','0','0','639','clientPayedDeptController.php?do=show&id=639'); -- id=1892
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1892', '383', '275', '','0'); -- id=1909
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '231815.48', 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 ('1892', '508', '275', '','0'); -- id=1896
UPDATE accountstree SET name = 'محمد حسن', customName = 'محمد حسن', customNameEn = 'محمد حسن', nameEn = 'محمد حسن', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-21 13:25:02' WHERE id = '508';
UPDATE clientdebtchange SET clientid = '75', clientdebtchangebefore = '275.000', clientdebtchangeamount = '275.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '639', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-21 18:38:36', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '275.000',discount='', reciptid='0', dailyentryid = '1892',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='275',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '639';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:50', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4872
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-21 18:38:53', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4873
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:08:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:38:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:38:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4874
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:09:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:39:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:39:13', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4875

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =640
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(60,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-21 18:39:13', userid = '1' WHERE clientid = '60';
UPDATE client SET  inUse = 0 where clientid = 60;
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 ('60','22210.00','22210','1','ايصال تحصيل (( قبض من عميل ))','640', '0', '2026-10-21 18:38:59', '1', 'clientPayedDeptController.php', '   ', '22210', '0', null, '0', null, null,'', '-1','1','1','22210','1','','69','0','','.'); -- id=640
UPDATE save SET  savecurrentvalue = '-802644.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-824854.80','22210', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '640', '-802644.8', '2026-10-21 18:39:14', '1',  'clientPayedDeptController.php','60','','0'); -- id=392
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22210', '22210', '2026-10-21', '1', '0', '0', '2026-10-21 18:39:14','اضافة ايصال سداد للعميل الحاج/محمد عبدالجواد ','1','0','0','0','640','clientPayedDeptController.php?do=show&id=640'); -- id=1893
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1893', '383', '22210', '','0'); -- id=1910
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '254025.48', 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 ('1893', '493', '22210', '','0'); -- id=1897
UPDATE accountstree SET name = 'الحاج/محمد عبدالجواد ', customName = 'الحاج/محمد عبدالجواد ', customNameEn = 'الحاج/محمد عبدالجواد ', nameEn = 'الحاج/محمد عبدالجواد ', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 20:34:36' WHERE id = '493';
UPDATE clientdebtchange SET clientid = '60', clientdebtchangebefore = '22210.000', clientdebtchangeamount = '22210.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '640', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-21 18:38:59', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '22210.000',discount='', reciptid='0', dailyentryid = '1893',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='22210',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '640';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:09:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:39:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:39:14', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4876
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 15:09:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 18:39:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 18:39:16', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4877
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:06:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:36:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:36:27', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:07:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:37:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 19:37:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4879
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:08:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:38:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-21 19:38:31', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=4880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:08:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:38:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-21 19:38:38', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=4881
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:08:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:38:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:38:57', '1', 'details', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=details&id=59'); -- id=4882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:09:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:39:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-21 19:39:59', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4883
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:10:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:40:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 19:40:17', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=4884
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:10:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:40:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:40:53', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=4885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:12:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:42:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 19:42:39', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=4886
BEGIN;
CALL supplierInUse(15,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('15', '20008.00', '10900', '1', 'ايصال دفع لمورد', '1', '9108', '2026-10-21 19:37:44', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','10900','1','0','0','0','32',''); -- id=114
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '20008.00', supplierdebtchangeamount = '10900', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '9108', supplierdebtchangedate = '2026-10-21 19:37:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10900',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='20008',debtchangamountInSupplierCurrency='10900',debtchangafterInSupplierCurrency='9108', paySerialNo='32',tagids='' WHERE supplierdebtchangeid = '114';
UPDATE supplier SET  suppliercurrentDebt = '9108',suppliercurrentDebtInCurrency= '9108' , userid = '1', supplierdate = '2026-10-21 19:42:40'   WHERE supplierid = '15';
UPDATE supplier SET  inUse = 0 where supplierid = 15;
UPDATE save SET  savecurrentvalue = '-813544.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-802644.80','10900', '1', '1', 'ايصال دفع لمورد', '114', '-813544.8', '2026-10-21 19:42:40', '1',  'supplierPayedDeptController.php','0','','0'); -- id=393
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10900', '10900', '2026-10-21', '1', '0', '0', '2026-10-21 19:42:40','ايصال دفع لمورد ( شركه الصقر اب لايت  ) ','1','0','0','0','114','supplierReportsController.php?do=show&id=114'); -- id=1894
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1894', '467', '10900', '','0'); -- id=1911
UPDATE accountstree SET name = 'شركه الصقر اب لايت ', customName = 'شركه الصقر اب لايت ', customNameEn = 'شركه الصقر اب لايت ', nameEn = 'شركه الصقر اب لايت ', parent = '81', accountNature = '1', theValue = '9108', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 21:45:29' WHERE id = '467';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1894', '383', '10900', '','0'); -- id=1898
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '243125.48', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '15', supplierdebtchangebefore = '20008.00', supplierdebtchangeamount = '10900.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '9108.00', supplierdebtchangedate = '2026-10-21 19:37:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '1894',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='10900',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='20008',debtchangamountInSupplierCurrency='10900',debtchangafterInSupplierCurrency='9108', paySerialNo='32',tagids='' WHERE supplierdebtchangeid = '114';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:12:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:42:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 19:42:41', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=4887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:12:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:42:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-21 19:42:43', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=4888
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:12:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:42:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-21 19:42:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=4889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:12:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:42:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:42:51', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=4890
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:13:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:43:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:43:51', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4891
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('06ad8f99c6e7c4', '2026-10-21 19:42:52', '1', '81528.92', '54628.92', '0', '0', '-26900.00', '-26900.00', '', '-26900', '1', '2026-10-21 19:43:52', '', '1', '0', '', '1', '6','1','0.00','-1','0','1','0','0','0','0','0'); -- id=2
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00028', '2', '8', '28', '40', '480', '19200', '0', '', '28','','','0','0','0','0','0','480','19200','0','0','0','0','0','0','0','1'); -- id=5
UPDATE product SET productName = 'عود قبل الجبس ', productDescription = '', productCatId = '8', productBuyPrice = '480.00', productSellAllPrice = '525.00', productSellUnitPrice = '525.00', productSellHalfPrice = '525.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '5', parcode = '00028',type ='0', expireDate = '0' , dailyentryId = '33',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '468.24',meanbuyprice_withDiscount = '468.24' , productbuypricereal = '475.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.11' , buyhalf_precentage = '2.11' , buypart_precentage = '10.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='468.24',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='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '28';
UPDATE returnbuybilldetail SET  lastbuyprice = 480 , meanbuyprice = 468.24, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 468.24
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 468.24, lastbuyprice_withDiscountAndTax = 480
                where returnbuybilldetailid = 5;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 28;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '40', '1', '2', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '42', '2', '1', '2026-10-21 19:42:52','0','0'); -- id=5185
INSERT INTO returnbuybilldetail (Parcode, returnbuybillid, returnbuybilldetailcatid, returnbuybilldetailproductid, returnbuybilldetailquantity, returnbuybilldetailprice, returnbuybilldetailtotalprice, discountvalue, note, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid, returnbuybilldetailpriceC, returnbuybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00604', '2', '20', '604', '350', '22', '7700', '0', '', '604','','','0','0','0','0','0','22','7700','0','0','0','0','0','0','0','1'); -- id=6
UPDATE product SET productName = 'لمبه كاسه ويرليس سنتين ', productDescription = '', productCatId = '20', productBuyPrice = '22.00', productSellAllPrice = '32.00', productSellUnitPrice = '32.00', productSellHalfPrice = '32.00', productDate = '2026-10-18', conditions = '0', userId = '1', limitamount = '1', parcode = '00604',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '22',lastbuyprice_withDiscount = '22',meanbuyprice = '22',meanbuyprice_withDiscount = '22' , productbuypricereal = '22.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='22',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='22',meanbuyprice_withTax='22',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='22',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '604';
UPDATE returnbuybilldetail SET  lastbuyprice = 22 , meanbuyprice = 22, lastbuyprice_withDiscount = 22, meanbuyprice_withDiscount = 22
        , lastbuyprice_withTax = 22, meanbuyprice_withTax = 22, lastbuyprice_withDiscountAndTax = 22
                where returnbuybilldetailid = 6;
UPDATE productunit SET proUnitBuyPrice  = 22 * productnumber WHERE productid = 604;
UPDATE storedetail SET  productquantity = '-122', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '604';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('604', '1', '350', '1', '2', 'اضافة فاتورة مردودات مشتريات', 'returnBuyBillController.php', '228', '-122', '1', '2026-10-21 19:42:52','0','0'); -- id=5186
UPDATE supplier SET  suppliercurrentDebt = '54628.92',suppliercurrentDebtInCurrency= '54628.92' , userid = '1', supplierdate = '2026-10-21 19:43:52'   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', '26900', '1', 'اضافة فاتورة مردوات مشتريات', '2', '54628.92', '2026-10-21 19:42:52', '1', 'returnBuyBillController.php', 'اضافة فاتورة مردوات مشتريات', '0','', '0','1','1','26900','1','81528.92','26900','54628.92','0',''); -- id=115
update returnbuybill set dailyentryid='0,0' where returnbuybillid=2;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:13:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:43:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-21 19:43:54', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnBuyBillController.php?do=editprint&id=2'); -- id=4892
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:13:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:43:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:43:59', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4893
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:14:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:44:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:44:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4894
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:14:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:44:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:44:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:14:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:44:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:44:51', '1', 'uinuseproducts', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=uinuseproducts'); -- id=4896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:14:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:44:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:44:52', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=sucess'); -- id=4897
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:14:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:44:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:44:54', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4898
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:15:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:45:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:45:06', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:17:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:47:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-21 19:47:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productCatController.php?do=show'); -- id=4900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:18:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:48:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:48:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4901
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:18:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:48:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:48:53', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4902
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:19:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:49:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:49:16', '1', 'executeOperation', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=executeOperation'); -- id=4903
update product set productCatId=6 where productId in(604);
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:19:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:49:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:49:16', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=sucess'); -- id=4904
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:19:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:49:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-21 19:49:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4905
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:20:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:50:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:50:16', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4906
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 ('06ad8f9e0972fa', '2026-10-21 19:44:00', '16', '7100.00', '18000', '0', '0', '26900.00',  '26900.00', '16000', '10900', '1', '2026-10-21 19:50:16', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=67
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 ('00604', '67', '6', '604', '350', '22', '7700.00', '0', '', '2026-10-21 19:50:16', '604','','','0','0','0','0','0',null,'22','7700','0','0','0','0','0','0','0','0','1'); -- id=244
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 19:44:00', 1, 604, 0, 0
                    , 22, 350, 0, 0, 1, '2026-10-21 19:50:16')
                ON DUPLICATE KEY UPDATE buyprice = 22,
                        buyQuantity =buyQuantity+350, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 19:50:16' ; -- id=244
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('604', '22', '350', '0', 'buyBillController.php', '244', '', '0', '0'); -- id=244
UPDATE product SET  productBuyPrice = "22" WHERE productId = 604 ;
UPDATE buybilldetail SET  quantitybefore = -122 WHERE buybilldetailid = 244 ;
UPDATE product SET productName = 'لمبه كاسه ويرليس سنتين ', productDescription = '', productCatId = '6', productBuyPrice = '22.00', productSellAllPrice = '32.00', productSellUnitPrice = '32.00', productSellHalfPrice = '32.00', productDate = '2026-10-18', conditions = '0', userId = '1', limitamount = '1', parcode = '00604',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '22',lastbuyprice_withDiscount = '22',meanbuyprice = '22',meanbuyprice_withDiscount = '22' , productbuypricereal = '22.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='22',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='22',meanbuyprice_withTax='22',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='22',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '604';
UPDATE buybilldetail SET  lastbuyprice = 22 , meanbuyprice = 22, lastbuyprice_withDiscount = 22, meanbuyprice_withDiscount = 22
        , lastbuyprice_withTax = 22, meanbuyprice_withTax = 22, lastbuyprice_withDiscountAndTax = 22
                where buybilldetailid = 244;
UPDATE productunit SET proUnitBuyPrice  = 22 * productnumber WHERE productid = 604;
UPDATE storedetail SET  productquantity = '228', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '604';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('604', '1', '350', '0', '67', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-122', '228', '1', '2026-10-21 19:44:00','0','0'); -- id=5187
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 ('00028', '67', '8', '28', '40', '480', '19200.00', '0', '', '2026-10-21 19:50:16', '28','','','0','0','0','0','0',null,'480','19200','0','0','0','0','0','0','0','0','1'); -- id=245
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 19:44:00', 1, 28, 0, 0
                    , 480, 40, 0, 0, 1, '2026-10-21 19:50:17')
                ON DUPLICATE KEY UPDATE buyprice = 480,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 19:50:17' ; -- id=245
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('28', '480', '40', '0', 'buyBillController.php', '245', '', '0', '0'); -- id=245
UPDATE product SET  productBuyPrice = "480" WHERE productId = 28 ;
UPDATE buybilldetail SET  quantitybefore = 2 WHERE buybilldetailid = 245 ;
UPDATE product SET productName = 'عود قبل الجبس ', productDescription = '', productCatId = '8', productBuyPrice = '480.00', productSellAllPrice = '525.00', productSellUnitPrice = '525.00', productSellHalfPrice = '525.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '5', parcode = '00028',type ='0', expireDate = '0' , dailyentryId = '33',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '479.44',meanbuyprice_withDiscount = '479.44' , productbuypricereal = '475.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.11' , buyhalf_precentage = '2.11' , buypart_precentage = '10.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',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='480',meanbuyprice_withTax='479.44',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '28';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 479.44, lastbuyprice_withDiscount = 480, meanbuyprice_withDiscount = 479.44
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 479.44, lastbuyprice_withDiscountAndTax = 480
                where buybilldetailid = 245;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 28;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '28';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('28', '1', '40', '0', '67', 'اضافة فاتورة مشتريات', 'buyBillController.php', '2', '42', '1', '2026-10-21 19:44:00','0','0'); -- id=5188
UPDATE supplier SET  suppliercurrentDebt = '18000',suppliercurrentDebtInCurrency= '18000' , userid = '1', supplierdate = '2026-10-21 19:50:16'   WHERE supplierid = '16';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('16', '7100.00', '10900', '0', 'اضافة فاتورة مشتريات', '67', '18000', '2026-10-21 19:44:00', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10900','1','7100','10900','18000','0',''); -- id=116
UPDATE save SET  savecurrentvalue = '-829544.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-813544.80','16000', '1', '1', 'اضافة فاتورة مشتريات', '67', '-829544.8', '2026-10-21 19:44:00', '1',  'buyBillController.php','0','','0'); -- id=394
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26900', '26900', '2026-10-21', '1', '0', '0', '2026-10-21 19:50:18','اضافة فاتورة مشتريات رقم 67','1','0',null,'0','67','buyBillController.php?do=details&id=67'); -- id=1895
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1895', '382', '26900', '','0'); -- id=1912
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2195468.89', 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 ('1895', '478', '26900', '','0'); -- id=1899
UPDATE accountstree SET name = 'تاون ليد ', customName = 'تاون ليد ', customNameEn = 'تاون ليد ', nameEn = 'تاون ليد ', parent = '81', accountNature = '1', theValue = '34000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 18:39:04' WHERE id = '478';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16000', '16000', '2026-10-21', '1', '0', '0', '2026-10-21 19:50:18','اضافة فاتورة مشتريات رقم 67 - سداد الفاتورة للمورد','1','0',null,'0','67','buyBillController.php?do=details&id=67'); -- id=1896
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1896', '478', '16000', '','0'); -- id=1913
UPDATE accountstree SET name = 'تاون ليد ', customName = 'تاون ليد ', customNameEn = 'تاون ليد ', nameEn = 'تاون ليد ', parent = '81', accountNature = '1', theValue = '18000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 18:39:04' WHERE id = '478';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1896', '383', '16000', '','0'); -- id=1900
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '227125.48', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
update buybill set dailyentryid='1895,1896' where buybillid=67;
COMMIT;
UPDATE product SET overAllAveragePrice = 480 WHERE productId = 28;UPDATE product SET overAllAveragePrice = 22 WHERE productId = 604;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:20:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:50:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:50:20', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=67'); -- id=4907
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:20:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:50:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:50:42', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4908
UPDATE productunit SET unitid = '1', productid = '284', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0028401',proUnitSellAllPrice='135',proUnitSellHalfPrice='135',proUnitSellUnitPrice ='150',proUnitBuyPrice='115',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '284';
UPDATE product SET productName = 'لفه ليد بروفايل 5 متر اب لايت ', productDescription = '', productCatId = '7', productBuyPrice = '108', productSellAllPrice = '135', productSellUnitPrice = '150', productSellHalfPrice = '135', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00284',type ='0', expireDate = '0' , dailyentryId = '335',isService = '0',isOptic = '0',lastbuyprice = '115.00',lastbuyprice_withDiscount = '115',meanbuyprice = '115.00',meanbuyprice_withDiscount = '115' , productbuypricereal = '115' , buypricereal_precentage = '0' , buytotal_precentage = '17.39' , buyhalf_precentage = '17.39' , buypart_precentage = '30.43',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',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='115',meanbuyprice_withTax='115',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='115',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '284';
UPDATE productunit SET unitid = '1', productid = '202', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0020201',proUnitSellAllPrice='1350',proUnitSellHalfPrice='1350',proUnitSellUnitPrice ='1550',proUnitBuyPrice='1282',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '202';
UPDATE product SET productName = 'بكره ليد ويرليس دبل ورم', productDescription = '', productCatId = '6', productBuyPrice = '1282.5', productSellAllPrice = '1350', productSellUnitPrice = '1550', productSellHalfPrice = '1350', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00202',type ='0', expireDate = '0' , dailyentryId = '229',isService = '0',isOptic = '0',lastbuyprice = '1282.00',lastbuyprice_withDiscount = '1282',meanbuyprice = '1271.33',meanbuyprice_withDiscount = '1271.33' , productbuypricereal = '1250' , buypricereal_precentage = '0' , buytotal_precentage = '8' , buyhalf_precentage = '8' , buypart_precentage = '24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1282',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='1282',meanbuyprice_withTax='1271.33',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='1282',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '202';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:22:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:52:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:52:24', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4909
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 ('06ad8fb72c53a7', '2026-10-21 19:50:42', '15', '9108.00', '15173', '0', '0', '16065.00',  '16065.00', '10000', '6065', '1', '2026-10-21 19:52:24', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=68
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 ('00202', '68', '6', '202', '10', '1282.5', '12825.00', '0', '', '2026-10-21 19:52:24', '202','','','0','0','0','0','0',null,'1282.5','12825','0','0','0','0','0','0','0','0','1'); -- id=246
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 19:50:42', 1, 202, 0, 0
                    , 1282.5, 10, 0, 0, 1, '2026-10-21 19:52:25')
                ON DUPLICATE KEY UPDATE buyprice = 1282.5,
                        buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 19:52:25' ; -- id=246
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('202', '1282.5', '10', '0', 'buyBillController.php', '246', '', '0', '0'); -- id=246
UPDATE product SET  productBuyPrice = "1282.5" WHERE productId = 202 ;
UPDATE buybilldetail SET  quantitybefore = 2 WHERE buybilldetailid = 246 ;
UPDATE product SET productName = 'بكره ليد ويرليس دبل ورم', productDescription = '', productCatId = '6', productBuyPrice = '1282.50', productSellAllPrice = '1350.00', productSellUnitPrice = '1550.00', productSellHalfPrice = '1350.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00202',type ='0', expireDate = '0' , dailyentryId = '229',isService = '0',isOptic = '0',lastbuyprice = '1282.5',lastbuyprice_withDiscount = '1282.5',meanbuyprice = '1280.64',meanbuyprice_withDiscount = '1280.64' , productbuypricereal = '1250.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.00' , buyhalf_precentage = '8.00' , buypart_precentage = '24.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1282',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='1282.5',meanbuyprice_withTax='1280.64',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='1282.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 = '202';
UPDATE buybilldetail SET  lastbuyprice = 1282.5 , meanbuyprice = 1280.64, lastbuyprice_withDiscount = 1282.5, meanbuyprice_withDiscount = 1280.64
        , lastbuyprice_withTax = 1282.5, meanbuyprice_withTax = 1280.64, lastbuyprice_withDiscountAndTax = 1282.5
                where buybilldetailid = 246;
UPDATE productunit SET proUnitBuyPrice  = 1282.5 * productnumber WHERE productid = 202;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '10', '0', '68', 'اضافة فاتورة مشتريات', 'buyBillController.php', '2', '12', '1', '2026-10-21 19:50:42','0','0'); -- id=5189
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 ('00284', '68', '7', '284', '30', '108', '3240.00', '0', '', '2026-10-21 19:52:24', '284','','','0','0','0','0','0',null,'108','3240','0','0','0','0','0','0','0','0','1'); -- id=247
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21 19:50:42', 1, 284, 0, 0
                    , 108, 30, 0, 0, 1, '2026-10-21 19:52:25')
                ON DUPLICATE KEY UPDATE buyprice = 108,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-21 19:52:25' ; -- id=247
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('284', '108', '30', '0', 'buyBillController.php', '247', '', '0', '0'); -- id=247
UPDATE product SET  productBuyPrice = "108" WHERE productId = 284 ;
UPDATE buybilldetail SET  quantitybefore = 16 WHERE buybilldetailid = 247 ;
UPDATE product SET productName = 'لفه ليد بروفايل 5 متر اب لايت ', productDescription = '', productCatId = '7', productBuyPrice = '108.00', productSellAllPrice = '135.00', productSellUnitPrice = '150.00', productSellHalfPrice = '135.00', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00284',type ='0', expireDate = '0' , dailyentryId = '335',isService = '0',isOptic = '0',lastbuyprice = '108',lastbuyprice_withDiscount = '108',meanbuyprice = '110.43',meanbuyprice_withDiscount = '110.43' , productbuypricereal = '115.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '17.39' , buyhalf_precentage = '17.39' , buypart_precentage = '30.43',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='115',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='108',meanbuyprice_withTax='110.43',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='108',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '284';
UPDATE buybilldetail SET  lastbuyprice = 108 , meanbuyprice = 110.43, lastbuyprice_withDiscount = 108, meanbuyprice_withDiscount = 110.43
        , lastbuyprice_withTax = 108, meanbuyprice_withTax = 110.43, lastbuyprice_withDiscountAndTax = 108
                where buybilldetailid = 247;
UPDATE productunit SET proUnitBuyPrice  = 108 * productnumber WHERE productid = 284;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '30', '0', '68', 'اضافة فاتورة مشتريات', 'buyBillController.php', '16', '46', '1', '2026-10-21 19:50:42','0','0'); -- id=5190
UPDATE supplier SET  suppliercurrentDebt = '15173',suppliercurrentDebtInCurrency= '15173' , userid = '1', supplierdate = '2026-10-21 19:52:24'   WHERE supplierid = '15';
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 ('15', '9108.00', '6065', '0', 'اضافة فاتورة مشتريات', '68', '15173', '2026-10-21 19:50:42', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','6065','1','9108','6065','15173','0',''); -- id=117
UPDATE save SET  savecurrentvalue = '-839544.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-829544.80','10000', '1', '1', 'اضافة فاتورة مشتريات', '68', '-839544.8', '2026-10-21 19:50:42', '1',  'buyBillController.php','0','','0'); -- id=395
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16065', '16065', '2026-10-21', '1', '0', '0', '2026-10-21 19:52:27','اضافة فاتورة مشتريات رقم 68','1','0',null,'0','68','buyBillController.php?do=details&id=68'); -- id=1897
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1897', '382', '16065', '','0'); -- id=1914
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2211533.89', 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 ('1897', '467', '16065', '','0'); -- id=1901
UPDATE accountstree SET name = 'شركه الصقر اب لايت ', customName = 'شركه الصقر اب لايت ', customNameEn = 'شركه الصقر اب لايت ', nameEn = 'شركه الصقر اب لايت ', parent = '81', accountNature = '1', theValue = '25173', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 21:45:29' WHERE id = '467';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-10-21', '1', '0', '0', '2026-10-21 19:52:27','اضافة فاتورة مشتريات رقم 68 - سداد الفاتورة للمورد','1','0',null,'0','68','buyBillController.php?do=details&id=68'); -- id=1898
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1898', '467', '10000', '','0'); -- id=1915
UPDATE accountstree SET name = 'شركه الصقر اب لايت ', customName = 'شركه الصقر اب لايت ', customNameEn = 'شركه الصقر اب لايت ', nameEn = 'شركه الصقر اب لايت ', parent = '81', accountNature = '1', theValue = '15173', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 21:45:29' WHERE id = '467';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1898', '383', '10000', '','0'); -- id=1902
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '217125.48', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
update buybill set dailyentryid='1897,1898' where buybillid=68;
COMMIT;
UPDATE product SET overAllAveragePrice = 1282.31 WHERE productId = 202;UPDATE product SET overAllAveragePrice = 108 WHERE productId = 284;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:22:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:52:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-21 19:52:27', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=68'); -- id=4910
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:22:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:52:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-21 19:52:33', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4911
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:23:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:53:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-21 19:53:06', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4912
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-21' WHERE storedetailid = '284';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('284', '1', '10', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '46', '36', '1', '2026-10-21','0','0'); -- id=5191
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1080', '1080', '2026-10-21', '1', '0', '0', '2026-10-21 19:53:06','اعادة جرد للمنتج : (لفه ليد بروفايل 5 متر اب لايت /بروفايل) فى مخزن : (المخزن الرئيسي) بالكمية : 36','1','0',null,'0','5191','inventoryController.php?do=details&id=5191'); -- id=1899
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1899', '188', '1080', '','0'); -- id=1916
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-68504.3', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1899', '382', '1080', '','0'); -- id=1903
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2210453.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-21 16:23:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-21 19:53:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-21 19:53:11', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4913
